FormsAuthentication problem with popup login window

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

  1. #1

    Default FormsAuthentication problem with popup login window

    I have a problem with FormsAuthentication:

    I have two web applications:
    [url]http://localhost/bx/authentication[/url]
    [url]http://localhost/myapp[/url]

    I have a 'login' hyperlink in MyApp that opens
    [url]http://localhost/bx/authentication/login.aspx[/url] in a popup window. The popup
    window has a username and password text field and an ok button. The postback
    code for the ok button is:

    ....
    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
    1, txtUID.Text, DateTime.Now, DateTime.Now.AddMinutes(30), false,
    myPayload);
    string ticketstring = FormsAuthentication.Encrypt(ticket);
    HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName,
    ticketstring);
    Response.Cookies.Add(cookie);
    ....

    The web.config file in both applications has an authentication section:

    ....
    <authentication mode="Forms">
    <forms name="BXAuthentication" protection="All" />
    </authentication>
    ....

    This does not work. User.Identity is always null in MyApp. The weird thing
    is that when I add this code to MyApp's Page_Load method:

    Response.Write
    (Request.Cookies[FormsAuthentication.FormsCookieName].Value.ToString());

    I can actually see the serialized login ticket!! So the cookie is passed
    correctly from the popup window to MyApp, but somehow this does not count as
    being authenticated. How can I get MyApp to 'accept' the cookie? What am I
    missing? Is authentication accross AppDomains possible at all?

    Thanks for any help,

    Mark


    Mark Farragher Guest

  2. Similar Questions and Discussions

    1. Problems with access to an intranet through popup login window
      Hi, The site is in two folders, the inside and the outside. To get to the inside you call a popup window containing the login.asp file. I f you try...
    2. Popup window with DataGrid focus problem
      I have a main window with an editable DataGrid. When a user does double click in a cell a popup window opens that lets him select a value for the...
    3. Popup menu on popup window
      Hi, I want to create a popup menu when a button on a popup window is clicked. I have this in my popup window: myMenu =...
    4. can a popup window return data to parent window?
      Is it possible to do the following in php: I want to have a main form open. In the form I want a button that will open a popup window so the user...
    5. Removing NT popup login box
      Here's what I'm trying to do: I have a web page that's calling the server variable LOGON_USER to retrieve the userid of the person accessing it. ...
  3. #2

    Default FormsAuthentication problem with popup login window

    I have a problem with FormsAuthentication:

    I have two web applications:
    [url]http://localhost/bx/authentication[/url]
    [url]http://localhost/myapp[/url]

    I have a 'login' hyperlink in MyApp that opens
    [url]http://localhost/bx/authentication/login.aspx[/url] in a popup window. The popup
    window has a username and password text field and an ok button. The
    postback
    code for the ok button is:

    ....
    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
    1, txtUID.Text, DateTime.Now, DateTime.Now.AddMinutes(30), false,
    myPayload);
    string ticketstring = FormsAuthentication.Encrypt(ticket);
    HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName,
    ticketstring);
    Response.Cookies.Add(cookie);
    ....

    The web.config file in both applications has an authentication section:

    ....
    <authentication mode="Forms">
    <forms name="BXAuthentication" protection="All" />
    </authentication>
    ....

    This does not work. User.Identity is always null in MyApp. The weird thing
    is that when I add this code to MyApp's Page_Load method:

    Response.Write
    (Request.Cookies[FormsAuthentication.FormsCookieName].Value.ToString());

    I can actually see the serialized login ticket!! So the cookie is passed
    correctly from the popup window to MyApp, but somehow this does not count
    as
    being authenticated. How can I get MyApp to 'accept' the cookie? What am I
    missing? Is authentication accross AppDomains possible at all?

    Thanks for any help,

    Mark



    Mark Farragher Guest

  4. #3

    Default Re: FormsAuthentication problem with popup login window

    Look here for information regarding authentication across applications:

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthentication.asp[/url]

    --
    Ralph Page MBA, CMBA, MCDBA, MCSE, CCNA
    -------------------------------------------------------------------------
    "However beautiful the strategy, you should occasionally look at the
    results."
    -- Winston Churchill
    -------------------------------------------------------------------------
    "Mark Farragher" <mark@4castconsulting.com> wrote in message
    news:#JFa1H5gDHA.3104@TK2MSFTNGP11.phx.gbl...
    > I have a problem with FormsAuthentication:
    >
    > I have two web applications:
    > [url]http://localhost/bx/authentication[/url]
    > [url]http://localhost/myapp[/url]
    >
    > I have a 'login' hyperlink in MyApp that opens
    > [url]http://localhost/bx/authentication/login.aspx[/url] in a popup window. The popup
    > window has a username and password text field and an ok button. The
    postback
    > code for the ok button is:
    >
    > ....
    > FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
    > 1, txtUID.Text, DateTime.Now, DateTime.Now.AddMinutes(30), false,
    > myPayload);
    > string ticketstring = FormsAuthentication.Encrypt(ticket);
    > HttpCookie cookie = new
    HttpCookie(FormsAuthentication.FormsCookieName,
    > ticketstring);
    > Response.Cookies.Add(cookie);
    > ....
    >
    > The web.config file in both applications has an authentication section:
    >
    > ....
    > <authentication mode="Forms">
    > <forms name="BXAuthentication" protection="All" />
    > </authentication>
    > ....
    >
    > This does not work. User.Identity is always null in MyApp. The weird thing
    > is that when I add this code to MyApp's Page_Load method:
    >
    > Response.Write
    > (Request.Cookies[FormsAuthentication.FormsCookieName].Value.ToString());
    >
    > I can actually see the serialized login ticket!! So the cookie is passed
    > correctly from the popup window to MyApp, but somehow this does not count
    as
    > being authenticated. How can I get MyApp to 'accept' the cookie? What am I
    > missing? Is authentication accross AppDomains possible at all?
    >
    > Thanks for any help,
    >
    > Mark
    >
    >

    Me2 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