国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > .NET > 正文

asp.net身份驗(yàn)證方式介紹

2024-07-10 12:41:24
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
windows身份驗(yàn)證: IIS根據(jù)應(yīng)用程序的設(shè)置執(zhí)行身份驗(yàn)證.要使用這種驗(yàn)證方式,在IIS中必須禁用匿名訪問(wèn).
Forms驗(yàn)證:用Cookie來(lái)保存用戶憑證,并將 未經(jīng)身份驗(yàn)證的用戶重定向到自定義的登錄頁(yè).
Passport驗(yàn)證:通過(guò)Microsoft的集中身份驗(yàn)證服務(wù)執(zhí)行的,他為成員站點(diǎn)提供單獨(dú)登錄 和核心配置文件服務(wù).

一. 配置windows身份驗(yàn)證
1)配置IIS設(shè)置
asp.net身份驗(yàn)證方式(ref:DreamSpace <wbr>of <wbr>Dern)

2)設(shè)置Web.config
<system.web>
<authentication mode = "Windows">
<!--通知操作系統(tǒng)將當(dāng)前登錄的用戶的信任書傳遞給瀏覽器-->
<authorization>
<!--禁止匿名用戶訪問(wèn)-->
<deny users = "?"/>
</authorization>
</system.web>
二.配置Forms身份認(rèn)證
1)配置web.config
代碼如下:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
/Windows/Microsoft.Net/Framework/v2.x/Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<!--允許匿名用戶登錄register.aspx頁(yè)-->
<location path="register.aspx">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms name="auth" loginUrl="login.aspx" timeout="30" protection="All" path="/"></forms>
</authentication>
<!--禁止匿名用戶登錄-->
<authorization>
<deny users="?"/>
</authorization>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 兴文县| 乌兰察布市| 富锦市| 湘潭县| 邹平县| 阿城市| 九寨沟县| 霍州市| 射阳县| 蓬溪县| 三原县| 大化| 即墨市| 安丘市| 都匀市| 清新县| 桐城市| 韶山市| 贵南县| 东安县| 海兴县| 邛崃市| 阿鲁科尔沁旗| 若羌县| 闽清县| 遵义市| 东乡县| 颍上县| 多伦县| 页游| 鹿泉市| 秦安县| 天柱县| 双峰县| 朝阳市| 剑河县| 博白县| 宜阳县| 阳江市| 佛坪县| 玛多县|