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 question is, can I have more than one logon page using ASP.NET Membership without creating separate applications in IIS?
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