Using two login pages in forms authentification?

Discussion in 'ASP .Net' started by =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=, Jan 11, 2006.

  1. Hello, following problem:

    I have set two folders in the web.config file, that should be protected
    against anonymous users. I am using forms authentification. Is there a way to
    use two login pages? If a not authentificated user wants to access secured
    folder1, he should be redirect to the page login1.aspx, but, if an anonymous
    user wants to access folder2, he should be redirect to login2.aspx.

    Is such a configuration possible? How to make such a rule in web.config?

    I am using .net 1.1
     
    =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=, Jan 11, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=

    mortb Guest

    I think that the two folders may have their own web.config files which will
    make it possible to set different authentication behvaiours for each of the
    two.

    hope this helps!

    mortb

    "the friendly display name"
    <> wrote in message
    news:...
    > Hello, following problem:
    >
    > I have set two folders in the web.config file, that should be protected
    > against anonymous users. I am using forms authentification. Is there a way
    > to
    > use two login pages? If a not authentificated user wants to access secured
    > folder1, he should be redirect to the page login1.aspx, but, if an
    > anonymous
    > user wants to access folder2, he should be redirect to login2.aspx.
    >
    > Is such a configuration possible? How to make such a rule in web.config?
    >
    > I am using .net 1.1
     
    mortb, Jan 12, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=

    Joey Guest

    Check up on Roles in FormsAuthentication. You can plant code in the
    HttpAuthenticateRequest() function in Global.asax that will insert user
    roles (gained from DB or web.config) into the HttpContext. After that,
    in your web.config <location> tags, just assign the different roles as
    "allowed" and then denied="*" afterwards. All it takes then is a call
    in your code behind....

    if(HttpContext.User.IsInRole("Administrator")
    {
    somecode;
    }

    I know this way works in both VS2003 and VS2005. I also know that the
    user/role mangement stuff is built right in to VS2005...but I haven't
    tried it yet.
     
    Joey, Jan 12, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FsYW1FbGlhcw==?=

    SSL and Forms authentification

    =?Utf-8?B?U2FsYW1FbGlhcw==?=, Nov 10, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    375
    Steven Cheng[MSFT]
    Nov 25, 2004
  2. Dan
    Replies:
    2
    Views:
    2,650
    =?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=
    Nov 29, 2004
  3. Dan
    Replies:
    0
    Views:
    384
  4. HIK

    Forms authentification

    HIK, Oct 20, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    633
    Patrick.O.Ige
    Oct 21, 2005
  5. Jonas S.

    Login using Basic authentification

    Jonas S., Aug 2, 2004, in forum: ASP General
    Replies:
    1
    Views:
    115
    Tom Kaminski [MVP]
    Aug 2, 2004
Loading...

Share This Page