NET移植案例学习:建造Web站点(6)
来源:互联网 发布:淘宝提升排名方法 编辑:程序博客网 时间:2024/06/08 19:41
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> 图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
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
document.write(baiduCproIFrame());--><?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
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- NET移植案例学习:建造Web站点(6)
- NET移植案例学习:建造Web站点(7)
- NET移植案例学习:建造Web站点(5)
- NET移植案例学习:建造Web站点(4)
- NET移植案例学习:建造Web站点(3)
- NET移植案例学习:建造Web站点(2)
- NET移植案例学习:建造Web站点(1)
- .net 学习站点大全
- .net学习站点
- .net学习站点大汇总
- .NET学习站点大收集
- asp .net推荐学习站点
- .NET学习:Cookie案例
- 使 ASP.NET Web 站点易于访问
- 使 ASP.NET Web 站点易于访问
- 使 ASP.NET Web 站点易于访问
- 使 ASP.NET Web 站点易于访问
- ASP.NET 2.0 中的 Web 站点操作
- 投票管理程序
- ASP.NET中的CodeBehind技术(1)
- 简体中文转换为繁体中文的PHP函数
- NET移植案例学习:建造Web站点(7)
- 一个没有MYSQL数据库支持的简易留言本的编写
- NET移植案例学习:建造Web站点(6)
- 模仿OSO的论坛(四)
- NET移植案例学习:建造Web站点(5)
- 繁体中文转换为简体中文的PHP函数
- NET移植案例学习:建造Web站点(4)
- 我用php+mysql写的留言本
- NET移植案例学习:建造Web站点(3)
- 在PHP3中实现SESSION的功能(三)
- NET移植案例学习:建造Web站点(2)