3

I use ASP.NET and ASP.NET Authentication.

I have a website with structure like:

ROOT
   - CMS
     - AdminCms
     - web.conf*
   - FORUM
     - AdminForum
      - web.conf*
   - web.conf ***

Now in web.conf *** I use for CMS LOGIN PAGE

<authentication mode="Forms">
  <forms loginUrl="~/Cms/AdminCms/Login.aspx" timeout="2880" />
</authentication>

My Questions:

  • How can I have another DEFAULT LOGIN PAGE for another folder? (if the user use for example FORUM).
  • Would be possible insert in web.conf* another

<authentication mode="Forms">
  <forms loginUrl="~/Forum/AdminForum/Login.aspx" timeout="2880" />
</authentication>

Any ideas?

2
  • Why do you need two separate login pages? You can just redirect to the right page (CMS or forum) after a successful login, depending on where the user came from. Commented Nov 12, 2010 at 17:52
  • yes sounds good. How to do it? could you send me a link of example? thanks Commented Nov 12, 2010 at 19:27

2 Answers 2

2

Based on my comment earlier - Forms authentication allows redirecting a user to different pages after a successful login. To enable this, the forms authentication keeps track of the original page a user came from in the ReturnUL request parameter to the login page.

In your case you could do something like this in the codebehind of your login page after a successful login:

string originalTarget = Request.Params["ReturnUrl"];

if(originalTarget  != null)
{
   if(originalTarget.Contains(@"/FORUM/")
      Response.Redirect(someForumURL);
   else
      Response.Redirect(someCMSURL);
}

Edit: Here also a link to an article - Forms Authentication - Redirecting users to a Page other than Default.aspx

Sign up to request clarification or add additional context in comments.

Comments

0

If you mark both the folders, CMD and Forum as an application in IIS, you can easily do this since both of them will be a separate application domain.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.