views:

39

answers:

2

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: http://stackoverflow.com/questions/525988/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?

A: 

use one login page and call ascx Controls

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

Asad Butt
The requirement is two login pages. This would allow a redirect to a login page per section, opposed to a share one.
Josh
A: 

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

Josh