欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp.net?web?api2設(shè)置默認(rèn)啟動(dòng)登錄頁(yè)面的方法

 更新時(shí)間:2022年09月22日 09:18:13   作者:小小魚(yú)34309335  
這篇文章主要介紹了asp.net?web?api2設(shè)置默認(rèn)啟動(dòng)登錄頁(yè)面的方法,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

1.在Global.asax文件中添加Application_BeginRequest方法,如下如所示:

public class WebApiApplication : HttpApplication
{
    protected void Application_Start()
    {
        log4net.Config.XmlConfigurator.Configure(new FileInfo(Server.MapPath("~/Web.config")));
        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(WebApiConfig.Register);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
    }
    
    
    protected void Application_BeginRequest(object sender, EventArgs e)
    {
        if (Context.Request.FilePath == "/") 
            Context.RewritePath("home/page/login.html");
    }
}

靜態(tài)頁(yè)面的目錄結(jié)構(gòu)如下所示:

2.等啟動(dòng)項(xiàng)目后,到了登錄頁(yè),有可能會(huì)發(fā)現(xiàn)靜態(tài)資源,如圖片,css,js文件全部加載失敗,這個(gè)時(shí)候需要修改一下路徑,如下所示:

登錄成功跳轉(zhuǎn)的頁(yè)面也要注意下。

備注:項(xiàng)目使用rider2022.2.3開(kāi)發(fā) 

到此這篇關(guān)于asp.net web api2設(shè)置默認(rèn)啟動(dòng)登錄頁(yè)面的文章就介紹到這了,更多相關(guān)asp.net web api2默認(rèn)登錄頁(yè)面內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論