<location path="Admin">
<system.web>
<authorization>
<deny users="?">
</authorization>
</system.web>
</location>
用戶需要登錄后才能訪問Admin文件夾下的文件
添加using指令 using System.Web.Configuration
后創(chuàng)建Configuration 對象
string App_Path=Request.ApplicationPath;//訪問線程應(yīng)用程序
Configuration Myconfig=WebConfigurationManager.OpenWebConfiguration(App_Path);//打開webConfig文件
SystemWebSectionGroup Mysysweb=(SystemWebSectionGroup )Myconfig.GetSectionGroup("system.web");//配置節(jié)
if(Mysysweb.Authentication.Mode.Tostring()=="Forms")
{
Response.Write("這是一個Internet驗證模式");
}
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點擊舉報。