Forms Authentication with http/https

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

  1. #1

    Default Forms Authentication with http/https

    Hi,

    I am trying to implement Single Sign On solution to my web applications.

    I have developed a web application which does authenticaion and it is SSL
    based.
    I am having a problem when redirecting to the requested web site(http based)
    after authentication (https based)

    Let us say I have

    Site A - An application (configured to do forms authentication on Site B)
    Site B - An application which does authentication which is https based

    I try to redirect in site B using,

    System.Web.Security.FormsAuthentication.RedirectFr omLoginPage("test", False)

    It works but one problem.

    After Authentication the Site B tries to redirect to the application A but
    still uses https and not http as expected.


    I appreciated your help,

    -Holy



    Holysmoke Guest

  2. Similar Questions and Discussions

    1. Switching Between HTTP and HTTPS
      Hi I wish to have a web site that has most of the pages as normal HTTP pages but has some areas that use HTTPS. I want to have it that if a user...
    2. http to https
      Is there a coldfusion function that determines the gives me the protocol of the address bar(http, https) .I tried GetHttpRequestData, but I do not...
    3. Send Basic HTTP authentication credential in the first HTTP request
      Hello, How can I make the web service proxy class send basic authentication information in the HTTP header of the first request? My...
    4. Does ASP.Net v.1.1 Forms authentication mode require port 80 for http?
      I'm trying to do a "proof-of-concept" ASP.Net setup from my home/office. Since my ISP blocks port 80 - to prevent high-bandwidth serving from...
    5. HTTPS to HTTP
      When I am using server-side button to switch from https to http by using response.redirect "http://a.apsx" in response to the client event, I am...
  3. #2

    Default Re: Forms Authentication with http/https

    On Wed, 29 Sep 2004 07:27:03 -0700, Holysmoke <Holysmoke@discussions.microsoft.com> wrote:

    ¤ Hi,
    ¤
    ¤ I am trying to implement Single Sign On solution to my web applications.
    ¤
    ¤ I have developed a web application which does authenticaion and it is SSL
    ¤ based.
    ¤ I am having a problem when redirecting to the requested web site(http based)
    ¤ after authentication (https based)
    ¤
    ¤ Let us say I have
    ¤
    ¤ Site A - An application (configured to do forms authentication on Site B)
    ¤ Site B - An application which does authentication which is https based
    ¤
    ¤ I try to redirect in site B using,
    ¤
    ¤ System.Web.Security.FormsAuthentication.RedirectFr omLoginPage("test", False)
    ¤
    ¤ It works but one problem.
    ¤
    ¤ After Authentication the Site B tries to redirect to the application A but
    ¤ still uses https and not http as expected.
    ¤

    RedirectFromLoginPage uses the protocol of the login page application. You may want to consider
    using SSL on your login page if you're implementing Forms based authentication with SSL
    applications.


    Paul ~~~ [email]pclement@ameritech.net[/email]
    Microsoft MVP (Visual Basic)
    Paul Clement Guest

  4. #3

    Default Re: Forms Authentication with http/https

    Sorry . I don't understand. May be I have not clearly explained the problem

    FormsAuthentication.RedirectFromLoginPage methods redirects to original
    requested web site / application but it does not care about the http/https

    For eg.

    The orginal requested is not http based
    and the application that issues FormsAuthentcation.RedirectFromLoginPage is
    SSL based, it redirects to the correct original requested page but the
    protocol is still SSL and not just http as expected. Hope I have explained
    correctly.

    What is the work around for this?

    TIA,
    Holy

    "Paul Clement" wrote:
    > On Wed, 29 Sep 2004 07:27:03 -0700, Holysmoke <Holysmoke@discussions.microsoft.com> wrote:
    >
    > ¤ Hi,
    > ¤
    > ¤ I am trying to implement Single Sign On solution to my web applications.
    > ¤
    > ¤ I have developed a web application which does authenticaion and it is SSL
    > ¤ based.
    > ¤ I am having a problem when redirecting to the requested web site(http based)
    > ¤ after authentication (https based)
    > ¤
    > ¤ Let us say I have
    > ¤
    > ¤ Site A - An application (configured to do forms authentication on Site B)
    > ¤ Site B - An application which does authentication which is https based
    > ¤
    > ¤ I try to redirect in site B using,
    > ¤
    > ¤ System.Web.Security.FormsAuthentication.RedirectFr omLoginPage("test", False)
    > ¤
    > ¤ It works but one problem.
    > ¤
    > ¤ After Authentication the Site B tries to redirect to the application A but
    > ¤ still uses https and not http as expected.
    > ¤
    >
    > RedirectFromLoginPage uses the protocol of the login page application. You may want to consider
    > using SSL on your login page if you're implementing Forms based authentication with SSL
    > applications.
    >
    >
    > Paul ~~~ [email]pclement@ameritech.net[/email]
    > Microsoft MVP (Visual Basic)
    >
    Holysmoke Guest

  5. #4

    Default Re: Forms Authentication with http/https

    Holy,

    The behaviour that you describe is by desing so Forms will use the protocol
    of your login page as Paul wrote.
    If you still want to switch to http (althought I would not recomend you
    because of the replay attacks to the Forms cookie), you may use this code:

    Response.Redirect( FormsAuthentication.GetRedirectUrl( "userName",
    false ) );

    Regards.

    PD: If you want to read about SSO with Forms auth, here are some post about
    that.
    [url]http://weblogs.asp.net/hernandl/archive/2004/06/09/ssoformsauth.aspx[/url]

    --
    Hernan de Lahitte
    Lagash Systems S.A.
    [url]http://www.lagash.com[/url]
    [url]http://weblogs.asp.net/hernandl[/url]


    "Holysmoke" <Holysmoke@discussions.microsoft.com> escribió en el mensaje
    news:FBE33C48-0F88-492A-BD68-3EC7579E43BB@microsoft.com...
    > Sorry . I don't understand. May be I have not clearly explained the
    > problem
    >
    > FormsAuthentication.RedirectFromLoginPage methods redirects to original
    > requested web site / application but it does not care about the http/https
    >
    > For eg.
    >
    > The orginal requested is not http based
    > and the application that issues FormsAuthentcation.RedirectFromLoginPage
    > is
    > SSL based, it redirects to the correct original requested page but the
    > protocol is still SSL and not just http as expected. Hope I have explained
    > correctly.
    >
    > What is the work around for this?
    >
    > TIA,
    > Holy
    >
    > "Paul Clement" wrote:
    >
    >> On Wed, 29 Sep 2004 07:27:03 -0700, Holysmoke
    >> <Holysmoke@discussions.microsoft.com> wrote:
    >>
    >> ¤ Hi,
    >> ¤
    >> ¤ I am trying to implement Single Sign On solution to my web
    >> applications.
    >> ¤
    >> ¤ I have developed a web application which does authenticaion and it is
    >> SSL
    >> ¤ based.
    >> ¤ I am having a problem when redirecting to the requested web site(http
    >> based)
    >> ¤ after authentication (https based)
    >> ¤
    >> ¤ Let us say I have
    >> ¤
    >> ¤ Site A - An application (configured to do forms authentication on Site
    >> B)
    >> ¤ Site B - An application which does authentication which is https based
    >> ¤
    >> ¤ I try to redirect in site B using,
    >> ¤
    >> ¤ System.Web.Security.FormsAuthentication.RedirectFr omLoginPage("test",
    >> False)
    >> ¤
    >> ¤ It works but one problem.
    >> ¤
    >> ¤ After Authentication the Site B tries to redirect to the application A
    >> but
    >> ¤ still uses https and not http as expected.
    >> ¤
    >>
    >> RedirectFromLoginPage uses the protocol of the login page application.
    >> You may want to consider
    >> using SSL on your login page if you're implementing Forms based
    >> authentication with SSL
    >> applications.
    >>
    >>
    >> Paul ~~~ [email]pclement@ameritech.net[/email]
    >> Microsoft MVP (Visual Basic)
    >>

    Hernan de Lahitte Guest

  6. #5

    Default Re: Forms Authentication with http/https

    On Thu, 30 Sep 2004 01:43:01 -0700, Holysmoke <Holysmoke@discussions.microsoft.com> wrote:

    ¤ Sorry . I don't understand. May be I have not clearly explained the problem
    ¤
    ¤ FormsAuthentication.RedirectFromLoginPage methods redirects to original
    ¤ requested web site / application but it does not care about the http/https
    ¤
    ¤ For eg.
    ¤
    ¤ The orginal requested is not http based
    ¤ and the application that issues FormsAuthentcation.RedirectFromLoginPage is
    ¤ SSL based, it redirects to the correct original requested page but the
    ¤ protocol is still SSL and not just http as expected. Hope I have explained
    ¤ correctly.
    ¤
    ¤ What is the work around for this?
    ¤

    If I understand what you are saying, the protocol is not changing from https to http after
    performing the redirect. This behavior is correct in that RedirectFromLoginPage uses the current
    protocol. If the current protocol is https the page being redirected to will be https, not http.

    If you want to change the protocol from https to http, or vice versa, then you would have to use
    Response.Redirect instead.


    Paul ~~~ [email]pclement@ameritech.net[/email]
    Microsoft MVP (Visual Basic)
    Paul Clement Guest

  7. #6

    Default Re: Forms Authentication with http/https

    Response.Redirect(FormsAuthentication.GetRedirectU rl(..)) does not redirect
    to my http location instead it redirects to the https location. This
    confuses me a lot. Whether I have to take care of this my code to get
    redirected orginally in http location or it is taken care already?! :(

    See take the example of our newsgroup. We are requested to signin with
    passport with https and after successful authentication we are redirected to
    our newgroups which is http based.

    The same behaviour applies to FormsAuthentication or not?!

    I appreciate your help,

    Holy

    "Paul Clement" wrote:
    > On Thu, 30 Sep 2004 01:43:01 -0700, Holysmoke <Holysmoke@discussions.microsoft.com> wrote:
    >
    > ¤ Sorry . I don't understand. May be I have not clearly explained the problem
    > ¤
    > ¤ FormsAuthentication.RedirectFromLoginPage methods redirects to original
    > ¤ requested web site / application but it does not care about the http/https
    > ¤
    > ¤ For eg.
    > ¤
    > ¤ The orginal requested is not http based
    > ¤ and the application that issues FormsAuthentcation.RedirectFromLoginPage is
    > ¤ SSL based, it redirects to the correct original requested page but the
    > ¤ protocol is still SSL and not just http as expected. Hope I have explained
    > ¤ correctly.
    > ¤
    > ¤ What is the work around for this?
    > ¤
    >
    > If I understand what you are saying, the protocol is not changing from https to http after
    > performing the redirect. This behavior is correct in that RedirectFromLoginPage uses the current
    > protocol. If the current protocol is https the page being redirected to will be https, not http.
    >
    > If you want to change the protocol from https to http, or vice versa, then you would have to use
    > Response.Redirect instead.
    >
    >
    > Paul ~~~ [email]pclement@ameritech.net[/email]
    > Microsoft MVP (Visual Basic)
    >
    Holysmoke Guest

  8. #7

    Default Re: Forms Authentication with http/https

    Unfortunately FormsAuthentication does not have the same behavior as
    passports.
    Here you will have to "manually" switch protocols (from https to http) and
    use the Response.Redirect below:

    UriBuilder uri = new UriBuilder( Uri.UriSchemeHttp, Request.Url.Host );
    uri.Path = FormsAuthentication.GetRedirectUrl( "userName", false );
    Response.Redirect( uri.ToString() );

    NOTE: Remember to use attr: requireSSL="false" in <forms> config section.

    I hope this help you.

    --
    Hernan de Lahitte
    Lagash Systems S.A.
    [url]http://www.lagash.com[/url]
    [url]http://weblogs.asp.net/hernandl[/url]

    "Holysmoke" <Holysmoke@discussions.microsoft.com> escribió en el mensaje
    news:6F489254-1224-4CB6-92E7-8BCA56282EEF@microsoft.com...
    > Response.Redirect(FormsAuthentication.GetRedirectU rl(..)) does not
    > redirect
    > to my http location instead it redirects to the https location. This
    > confuses me a lot. Whether I have to take care of this my code to get
    > redirected orginally in http location or it is taken care already?! :(
    >
    > See take the example of our newsgroup. We are requested to signin with
    > passport with https and after successful authentication we are redirected
    > to
    > our newgroups which is http based.
    >
    > The same behaviour applies to FormsAuthentication or not?!
    >
    > I appreciate your help,
    >
    > Holy
    >
    > "Paul Clement" wrote:
    >
    >> On Thu, 30 Sep 2004 01:43:01 -0700, Holysmoke
    >> <Holysmoke@discussions.microsoft.com> wrote:
    >>
    >> ¤ Sorry . I don't understand. May be I have not clearly explained the
    >> problem
    >> ¤
    >> ¤ FormsAuthentication.RedirectFromLoginPage methods redirects to original
    >> ¤ requested web site / application but it does not care about the
    >> http/https
    >> ¤
    >> ¤ For eg.
    >> ¤
    >> ¤ The orginal requested is not http based
    >> ¤ and the application that issues
    >> FormsAuthentcation.RedirectFromLoginPage is
    >> ¤ SSL based, it redirects to the correct original requested page but the
    >> ¤ protocol is still SSL and not just http as expected. Hope I have
    >> explained
    >> ¤ correctly.
    >> ¤
    >> ¤ What is the work around for this?
    >> ¤
    >>
    >> If I understand what you are saying, the protocol is not changing from
    >> https to http after
    >> performing the redirect. This behavior is correct in that
    >> RedirectFromLoginPage uses the current
    >> protocol. If the current protocol is https the page being redirected to
    >> will be https, not http.
    >>
    >> If you want to change the protocol from https to http, or vice versa,
    >> then you would have to use
    >> Response.Redirect instead.
    >>
    >>
    >> Paul ~~~ [email]pclement@ameritech.net[/email]
    >> Microsoft MVP (Visual Basic)
    >>

    Hernan de Lahitte 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