Secure Multiple Applications in one Domain

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Secure Multiple Applications in one Domain

    I have a fairly simple scenario. I have a root web that is set-up with a
    web.config file that has forms authentication on and authorization to only
    allow logged in users to get in. Under the root web I have another web
    application that has its own web.config file. If I request a file in the
    root web, I am correctly redirected to the login page, I login in (just a
    simple code behind verification), and I call
    FormsAuthentication.RedirectFromLoginPage which correctly sends me to my
    originally requested page. So far so good. Now I want to access a file
    under the second web application that is under that same root web.
    Initially that web.config did not have authentication or authorization
    set-up to protect the app, so I got right into the page I requested without
    logging in. Then I figured I could remove the <authentication> and
    <authorization> tags from this web.config and the one that was up one level
    would take over. That did redirect me to the login page, but when I log in
    correctly it does not redirect me to my originally requested page, it just
    sends me back to the login page again. I even tried completely removing the
    web.config in the lower application which yielded the same result. Is there
    something I am missing here?


    ==============
    Joe Reazor
    Gorbel Inc.
    email: joerea=AT=gorbel=DOT=com


    Joe Reazor Guest

  2. Similar Questions and Discussions

    1. Sharing Constants in Multiple Applications - Public vs.Private
      I use private and public constants throughout my application to store hardcoded WSDL URLs and WebService methods. Many of these are the same in...
    2. using multiple applications in a site
      I am trying to learn more about using multiple Application.cfc files within a site, such as the example Bandwidth Associates site in Designing and...
    3. Are application web.config files cumulative when there are multiple applications?
      Hi, For a web application if I have various <location> authorizations set in the web.config file in the root directory and then also have another...
    4. Opening multiple Embedded Secure Document
      Hi, if I open a PDF file in Acrobat 6.0 containing multiple Embedded Secure Documents, I can only open 1 embedded document at the time, by clicking...
    5. multiple COM+ applications on 1 machine
      I have 2 virtual directories defined under IIS <default web site> for two different websites. Each website needs to use a different COM+...
  3. #2

    Default RE: Secure Multiple Applications in one Domain

    Hi Joe,

    From your description,you have a root web application which contains
    another sub application located in the
    root applicaiton 's root folder in IIS. The root application is using the
    form authenticaiton and protected the files from
    unauthenticated users. Now you want the sub application's file also be
    protected from unauthenticated users and
    use the same login page in the root web application. However, this works
    well when you visiting the pages in root application. However, when you
    visit the page in the sub application and be redirected to the login page
    and after the user login and use
    FormsAuthenticatoins.RedirectFromLoginPage to redirect to the former
    requested page, you found you are still get redirected to the login page,
    yes?

    As for this problem, here are some of my suggestions:
    1. Regarding on the repeatly be redirect to login page. I think the problem
    is likely caused by the login page is not in the same site. When you visit
    the sub app and be redirected to the parent web application's
    login page and that make the former requested url became the "login" page
    rather than the certain page in the sub web app. So that when you submit
    and call the FormsAuthenticatoins.RedirectFromLoginPage
    you will be repeatly redirect to the login page. I suggest you look at the
    url in the browser's address bar when be redirected to the login page first
    time
    or use Response.Write("<br>" +
    FormsAuthentication.GetRedirectUrl("username",fals e)); to output the url to
    confirm this.

    2. Since you want the sub app under the root application also use the
    authentication and authorization setting in the root web app, we don't need
    to create a sub applicatin, just make it a normal sub folder under the root
    applicaiton. And that'll also avoid may other issues with multi application
    with parent-sub folder structure. Also, we can specify heirarchy
    configuration setting in the root app's web.config without provide a
    web.config for each sub folder and here are some related references in msdn:

    #Configuration Inheritance
    [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconfigurationinher[/url]
    itance.asp?frame=true

    #Configuration <location> Settings
    [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconfigurationlocat[/url]
    ionsettings.asp?frame=true

    #Locking Configuration Settings
    [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconlockingconfigurati[/url]
    onsettings.asp?frame=true

    Hope also helps. Thanks.


    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]


    Steven Cheng[MSFT] Guest

  4. #3

    Default Re: Secure Multiple Applications in one Domain

    Steven,
    Thanks for the response. Yes you understood my problem perfectly. For
    your #1 solution: I had checked the ReturnUrl value and it does show the
    originally requested page. I even checked my web log file and it shows in
    this order: Original Page, Login Page, Post of Login Page, Original Page,
    back to Login Page. So it definitely sends me back to my original page, it
    just doesn't acknowledge that I am authenticated, probably the different
    application issue that you mention. Your second suggestion does make sense
    and I should have thought of that because I had another sub folder that
    wasn't set-up as an application and that one worked ok.

    I guess my next question then would be this: If my root web is the only
    place that has a web.config file and I have many applications under that
    which will no longer be "applications" in the sense that they won't have
    their own web.config files or be configured in IIS as applications, then how
    can I set specific settings for those applications. For instance, I want to
    set-up different error handling for each one, or different authorization?
    Is using the <location> element in my root web's web.config file the way to
    go? Is there any limitation as to what you can configure under the
    <location> element?


    Thanks again for your help.


    ==============
    Joe Reazor
    Gorbel Inc.
    email: joerea=AT=gorbel=DOT=com


    "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
    news:xdnTFilOEHA.484@cpmsftngxa10.phx.gbl...
    > Hi Joe,
    >
    > From your description,you have a root web application which contains
    > another sub application located in the
    > root applicaiton 's root folder in IIS. The root application is using the
    > form authenticaiton and protected the files from
    > unauthenticated users. Now you want the sub application's file also be
    > protected from unauthenticated users and
    > use the same login page in the root web application. However, this works
    > well when you visiting the pages in root application. However, when you
    > visit the page in the sub application and be redirected to the login page
    > and after the user login and use
    > FormsAuthenticatoins.RedirectFromLoginPage to redirect to the former
    > requested page, you found you are still get redirected to the login page,
    > yes?
    >
    > As for this problem, here are some of my suggestions:
    > 1. Regarding on the repeatly be redirect to login page. I think the
    problem
    > is likely caused by the login page is not in the same site. When you
    visit
    > the sub app and be redirected to the parent web application's
    > login page and that make the former requested url became the "login" page
    > rather than the certain page in the sub web app. So that when you submit
    > and call the FormsAuthenticatoins.RedirectFromLoginPage
    > you will be repeatly redirect to the login page. I suggest you look at the
    > url in the browser's address bar when be redirected to the login page
    first
    > time
    > or use Response.Write("<br>" +
    > FormsAuthentication.GetRedirectUrl("username",fals e)); to output the url
    to
    > confirm this.
    >
    > 2. Since you want the sub app under the root application also use the
    > authentication and authorization setting in the root web app, we don't
    need
    > to create a sub applicatin, just make it a normal sub folder under the
    root
    > applicaiton. And that'll also avoid may other issues with multi
    application
    > with parent-sub folder structure. Also, we can specify heirarchy
    > configuration setting in the root app's web.config without provide a
    > web.config for each sub folder and here are some related references in
    msdn:
    >
    > #Configuration Inheritance
    >
    [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconfigurationinher[/url]
    > itance.asp?frame=true
    >
    > #Configuration <location> Settings
    >
    [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconfigurationlocat[/url]
    > ionsettings.asp?frame=true
    >
    > #Locking Configuration Settings
    >
    [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconlockingconfigurati[/url]
    > onsettings.asp?frame=true
    >
    > Hope also helps. Thanks.
    >
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Support
    >
    > Get Secure! [url]www.microsoft.com/security[/url]
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    > Get Preview at ASP.NET whidbey
    > [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
    >
    >

    Joe Reazor Guest

  5. #4

    Default Re: Secure Multiple Applications in one Domain

    Hi Jeo,

    Thanks for the followup. As for the #1, the asp.net has provide the
    solution for using formsAuthentication across
    multi web application. That'll need use make some certain attributes in the
    <forms> element in web.config identical of all those
    web applications. Here is the reference in MSDN:

    #Forms Authentication Across Applications
    [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconformsauthenticatio[/url]
    nacrossapplications.asp?frame=true

    As for the #2, make all the folders in one application will be much easier
    and convenient than using FormsAuthentication across
    multi application. But since all the folders and their content(pages..) are
    in one web app. And the certain elemtns in web.config
    for the <location> setting are limited to some certain elements. Some
    elements can only be set in root web.config. You can have a look
    at the following web.config element schema to check

    #ASP.NET Settings Schema
    [url]http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfASPNETConfigurati[/url]
    onSectionSchema.asp?frame=true

    You can view all the element's description and see whether one element can
    be override at subdir level or only at application level.

    Hope these help. Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]

    Steven Cheng[MSFT] Guest

  6. #5

    Default Re: Secure Multiple Applications in one Domain

    Steven,
    Thanks for your help. Your answers and the article references you have
    provided have been helpful and I should now be able to do what I needed to
    do. Thanks again.


    ==============
    Joe Reazor
    Gorbel Inc.
    email: joerea=AT=gorbel=DOT=com


    "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
    news:9$xuBuLPEHA.544@cpmsftngxa10.phx.gbl...
    > Hi Jeo,
    >
    > Thanks for the followup. As for the #1, the asp.net has provide the
    > solution for using formsAuthentication across
    > multi web application. That'll need use make some certain attributes in
    the
    > <forms> element in web.config identical of all those
    > web applications. Here is the reference in MSDN:
    >
    > #Forms Authentication Across Applications
    >
    [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconformsauthenticatio[/url]
    > nacrossapplications.asp?frame=true
    >
    > As for the #2, make all the folders in one application will be much easier
    > and convenient than using FormsAuthentication across
    > multi application. But since all the folders and their content(pages..)
    are
    > in one web app. And the certain elemtns in web.config
    > for the <location> setting are limited to some certain elements. Some
    > elements can only be set in root web.config. You can have a look
    > at the following web.config element schema to check
    >
    > #ASP.NET Settings Schema
    >
    [url]http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfASPNETConfigurati[/url]
    > onSectionSchema.asp?frame=true
    >
    > You can view all the element's description and see whether one element can
    > be override at subdir level or only at application level.
    >
    > Hope these help. Thanks.
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Support
    >
    > Get Secure! [url]www.microsoft.com/security[/url]
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    > Get Preview at ASP.NET whidbey
    > [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
    >

    Joe Reazor Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139