NET移植案例学习:建造Web站点(6)
2008-05-01 04:29
253 查看
document.write(baiduCproIFrame());--> 图3Config.Web文件
<?xmlversion="1.0"encoding="utf-8"?>
<configuration>
<!--SECURITY
Thissectionsetsthesecuritypoliciesoftheapplication.
Possiblemodesare"Windows","Cookie",
"Passport"and"None"
-->
<!--UseCookieAuthenticationforexternalusers-->
<security>
<authenticationmode="Cookie">
<cookiecookie=".PRODAUTH"loginurl="https://
beta.visualstudio.NET/Login.aspx"
decryptionkey="autogenerate">
<credentialspasswordformat="Clear"/>
</cookie>
</authentication>
<authorization>
<allowusers="*"/>
</authorization>
</security>
</configuration>
图4认证代码
PublicSubcmdSubmit_Click(ByValsenderAsObject,ByValeAs_
System.EventArgs)
DimsUserIDAsString
DimsPasswordAsString
DimsAuthCookieAsString
'Externaluser,takethevaluesfromtheLoginform
sUserid=system.Convert.ToString(Me.txtUserID.Value)
sPassword=system.Convert.ToString(Me.txtPassword.Value)
adoRS=oBetaUser.LoginEx(sUserID,sPassword)
IfadoRS.recordcount=1Then
'loginsuccess-getasession
adoRS=osSession.GetNewSession_
(adoRS("BetaSiteID").Value.ToString().ToInt32())
IfNotadoRSIsNothingThen
IfadoRS.Recordcount>0Then
adoRS.movefirst()
'SettheauthenticationcookieusingtheSID
sAuthCookie=adoRS("SID").Value.ToString()
'useASP+authenticationtoauthenticatetheuser,
IfInstr(CookieAuthentication.GetRedirectUrl_
(sAuthCookie,True),"default.aspx")>0Then
CookieAuthentication.SetAuthCookie(sAuthCookie,True)
Response.Redirect(system.Convert.ToString(_
oSiteUser.GlobalPath)&"Home.aspx")
Else
CookieAuthentication.RedirectFromLoginPage(_
sAuthCookie,True)
EndIf
Else
'loginfailed
Response.Redirect("LoginFailed.aspx")
EndIf
Else
'loginfailed
Response.Redirect("LoginFailed.aspx")
EndIf
Else
'loginfailed
Response.Redirect("LoginFailed.aspx")
EndIf
EndSub
<?xmlversion="1.0"encoding="utf-8"?>
<configuration>
<!--SECURITY
Thissectionsetsthesecuritypoliciesoftheapplication.
Possiblemodesare"Windows","Cookie",
"Passport"and"None"
-->
<!--UseCookieAuthenticationforexternalusers-->
<security>
<authenticationmode="Cookie">
<cookiecookie=".PRODAUTH"loginurl="https://
beta.visualstudio.NET/Login.aspx"
decryptionkey="autogenerate">
<credentialspasswordformat="Clear"/>
</cookie>
</authentication>
<authorization>
<allowusers="*"/>
</authorization>
</security>
</configuration>
图4认证代码
PublicSubcmdSubmit_Click(ByValsenderAsObject,ByValeAs_
System.EventArgs)
DimsUserIDAsString
DimsPasswordAsString
DimsAuthCookieAsString
'Externaluser,takethevaluesfromtheLoginform
sUserid=system.Convert.ToString(Me.txtUserID.Value)
sPassword=system.Convert.ToString(Me.txtPassword.Value)
adoRS=oBetaUser.LoginEx(sUserID,sPassword)
IfadoRS.recordcount=1Then
'loginsuccess-getasession
adoRS=osSession.GetNewSession_
(adoRS("BetaSiteID").Value.ToString().ToInt32())
IfNotadoRSIsNothingThen
IfadoRS.Recordcount>0Then
adoRS.movefirst()
'SettheauthenticationcookieusingtheSID
sAuthCookie=adoRS("SID").Value.ToString()
'useASP+authenticationtoauthenticatetheuser,
IfInstr(CookieAuthentication.GetRedirectUrl_
(sAuthCookie,True),"default.aspx")>0Then
CookieAuthentication.SetAuthCookie(sAuthCookie,True)
Response.Redirect(system.Convert.ToString(_
oSiteUser.GlobalPath)&"Home.aspx")
Else
CookieAuthentication.RedirectFromLoginPage(_
sAuthCookie,True)
EndIf
Else
'loginfailed
Response.Redirect("LoginFailed.aspx")
EndIf
Else
'loginfailed
Response.Redirect("LoginFailed.aspx")
EndIf
Else
'loginfailed
Response.Redirect("LoginFailed.aspx")
EndIf
EndSub
相关文章推荐
- NET移植案例学习:建造Web站点(4)
- NET移植案例学习:建造Web站点(5)
- NET移植案例学习:建造Web站点(7)
- NET移植案例学习:建造Web站点(1)
- NET移植案例学习:建造Web站点(2)
- NET移植案例学习:建造Web站点(3)
- ASP.NET学习参考站点
- 从Native到Web(六), emscripten学习笔记: SDL游戏移植尝试
- ASP.NET项目站点配置Web.Config文件
- IIS中ASP.NET虚拟目录不继承主站点web.config设置的办法(转载)
- 一个学习asp.net的好站点...挺多案例的!
- (asp.net MVC学习)System.Web.Mvc.HtmlHelper学习及使用
- 构建高可用web站点学习(二)
- ASP.NET项目站点配置Web.Config文件【转】
- tfs 2013 利用 web deploy 完成asp.net站点自动发布
- Asp.net 2.0 - Web Parts学习笔记
- ASP.NET站点Web部署(一键发布的实现)
- ASP.NET Web Page应用深入探讨(强烈建议开发web的人学习)
- 结合高性能web站点构架话题在asp.net中petshop缓存的探究
- 在ASP.NET中创建安全的web站点(配置)