2
votes

I have an ASP.Net application that makes use of Forms authentication. I have two folders that are "protected" for administrators and registered users. I want to have two different login pages based on whether the user is trying to access the /admin/ or /members/ folder. Based on my understanding there can only be one login page configured in the web.config when using Forms based authentication?

At the moment I am using code to identify which "mode" the login page should display as on the page load of the login page. Below is a snippet of this code to convey the approach I am using:

Select Case GetRootFolderName(Request.QueryString("ReturnUrl"))
     Case "members"
          Return PageModes.Merchants
     Case "admin"
          Return PageModes.Admin
     Case Else
          Throw New Exception("Invalid protected folder")
End Select

Ideally I would like to have two separate login pages. Is this possible?

1

1 Answers

0
votes

You can have as many login pages as you want, and style them up as you see fit. The underlying membership provider will still return the same authentication token (usually as a cookie) whatever login page you used.