web.config
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings/>
<system.web>
<authorization>
<deny users="?"/>
</authorization>
<authentication mode="Forms" />
<compilation debug="true"/></system.web>
</configuration>
-----------------------------------------------
userlogged.aspx'登录成功后显示的页面
Partial Class userlogged
Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Label1.Text = Request.Cookies("username").Value
End Sub
End Class
-----------------------------
userlogin.aspx '登录界面
Imports System.Web.Security.FormsAuthentication
Partial Class userlogin
Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
System.Web.Security.FormsAuthentication.RedirectFromLoginPage("xubin", False)
End SubEnd Class
-------------------------------当我登录后,页面一直会跳回到userlogin.aspx上,高手指教
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings/>
<system.web>
<authorization>
<deny users="?"/>
</authorization>
<authentication mode="Forms" />
<compilation debug="true"/></system.web>
</configuration>
-----------------------------------------------
userlogged.aspx'登录成功后显示的页面
Partial Class userlogged
Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Label1.Text = Request.Cookies("username").Value
End Sub
End Class
-----------------------------
userlogin.aspx '登录界面
Imports System.Web.Security.FormsAuthentication
Partial Class userlogin
Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
System.Web.Security.FormsAuthentication.RedirectFromLoginPage("xubin", False)
End SubEnd Class
-------------------------------当我登录后,页面一直会跳回到userlogin.aspx上,高手指教
解决方案 »
- 在线等,请教一个数据控件问题,解决马上给分!!!!!!~~~
- 一个关于gridview绑定的问题
- 求救 大家有三级联动的实例代码吗?
- 公司第二次面谈的时候说其余都符合就是薪水可能要的太高,怎么办?
- 关于 ASP.NET 2.0 自定义控件!!!
- 请问怎样将2000下的数据源(ODBC)下的系统DSN导出并导入到另外一台机子上?
- 3个面试问题,没回答出来.
- 如何控制Frame的寬度?
- Oracle数据库,如何写这样的SQL》?
- 我在Form表单中加入onsubmit="this.action='index.aspx'"进行搜索出现的问题怎么样才能解决
- 初学者请教水晶报表9.2中文版的用法,急!
- 不知道的错误 从登录页面进行登录后 不能正确返回
<forms name=".DDD" loginUrl="userlogin.aspx" timeout="20" slidingExpiration="true" cookieless="UseDeviceProfile" protection="All" requireSSL="false" enableCrossAppRedirects="false" defaultUrl="xxxx.aspx" path="/"/>
“System.Threading.ThreadAbortException”类型的异常在 mscorlib.dll 中发生,但未在用户代码中进行处理
在 System.Threading.ThreadAbortException 中第一次偶然出现的“mscorlib.dll”类型的异常
“System.Threading.ThreadAbortException”类型的异常在 mscorlib.dll 中发生,但未在用户代码中进行处理
在 System.Threading.ThreadAbortException 中第一次偶然出现的“mscorlib.dll”类型的异常
“System.Threading.ThreadAbortException”类型的异常在 mscorlib.dll 中发生,但未在用户代码中进行处理
在 System.Threading.ThreadAbortException 中第一次偶然出现的“mscorlib.dll”类型的异常
“System.Threading.ThreadAbortException”类型的异常在 mscorlib.dll 中发生,但未在用户代码中进行处理
//FormsAuthentication.RedirectFromLoginPage(username, true); // 获得用户的角色列表
string roles = PERoles.GetRolesByUser(userInfo.UserId); //// 创建身份验证票
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
1, userInfo.UserName, DateTime.Now, DateTime.Now.AddMinutes(20), false, roles); // 创建身份验证票的加密字符串
string encryptedTicket = FormsAuthentication.Encrypt(authTicket); // 将加密字符串存储在 HttpCookie 对象中
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); // 将此 cookie 添加到返回给用户浏览器的 cookie 集合中
Response.Cookies.Add(authCookie); // 将用户重定向到最初请求的页
Response.Redirect(FormsAuthentication.GetRedirectUrl(userInfo.UserName, false));
当然,如果是asp.net1.1那就只有自己编写登录代码了。