开发者

Mulitple Login Pages using ASP.NET Membership

I'm trying to create two ASP.NET Membership login pages for an ASP.NET website I'm creating.

Here is structure:

/ - Anonymous Access for page off root

/registeredUser - Must be part of RegisteredUser Role
/registeredUser/login.aspx - Login page Registered Users  

/admin - Must be part of AdminUser Role
/admin/login.aspx - Login page Admin Users

Another person asked the question and it was suggested to use the location tag in the web.confg: Redirect user to Mulitple Login Pages using ASP.NET Membership

But I receive errors related to the using the forward slash / in the location path. I removed the forward slashes and the security rules are ignored.

So my questi开发者_如何学Goon is, can I have more than one logon page using ASP.NET Membership without creating separate applications in IIS?


use one login page and call ascx Controls

This will require single url and custom display will be easy on aspx Login Page


The solution I came up with was to redirect the user to other login page from the default login page in the Page Load event:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  Dim returnURL As String = Request.QueryString("ReturnUrl")

  If returnURL <> String.Empty AndAlso returnURL.Contains("registeredUser") Then
     Response.Redirect("~/registeredUser/login.aspx?" & AntiXss.UrlEncode(returnURL))
  End If
End Sub

This is based on an suggestion from David Qain at: http://forums.asp.net/t/1348477.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜