ASP.NET Authentication Issues

I use ASP.NET and ASP.NET authentication.

I have a site with a 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 create another LOGIN PAGE folder for another folder? (if the user uses, for example, FORUM).
  • Perhaps insert in web.conf * another

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

Any ideas?

+3
source share
2 answers

Based on my comment earlier - forms authentication allows you to redirect the user to different pages after a successful login. To enable this, forms authentication monitors the source page from which the user came to the login page in the ReturnUL request parameter.

- :

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

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

: - - , Default.aspx

+2

, CMD Forum IIS, , .

0

Source: https://habr.com/ru/post/1774569/


All Articles