Cookies y AxWebBrowser

From: xx (xx_at_discussions.microsoft.com)
Date: 09/08/04

  • Next message: Matthew Wieder: "Re: HELP! CreateProcessWithLogonW issue"
    Date: Wed, 8 Sep 2004 08:25:14 -0700
    
    

    My problem could no be exactly ASP.NET, but I think this is the best place to
    comment it.

    I have an ASP.NET page with "Forms" athentication (not Windows).
    (this page was already set in our web site, and must be continue as now for
    other webclients to use it)

    But now, I need an additional WinForms (C#) application, with an ActiveX
    AxWebBrowser control to display it.
    However, this new win client shouldn't start any new session via Forms
    authentication, because it's a already authenticated via Windows.

    This is imposible without the correct cookie, isn´t?.
    For this reason I've prepared a web service to be invoke by the win client
    and get the cookie.

     [WebMethod]
     public bool Login (string user, string pwd)
     {
             bool isPersistable = true;
             FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket (1,
    user, DateTime.Now, DateTime.Now.AddMonths(2), isPersistable, string.Empty);
             string encryptedTicket = FormsAuthentication.Encrypt (authTicket);
             HttpCookie authCookie = new
    HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
             if (isPersistable)
             {
                    authCookie.Expires = authTicket.Expiration;
             }
             HttpContext context = this.Context;
             context.Response.Cookies.Add(authCookie);
             return true;
     }

    At the client I do the next:
     if (myService.Login (user,pwd))
             System.Net.Cookie cookie = myService.CookieContainer.GetCookies(new
    System.Uri (myService.Url))cookieColl[0]

    Until here, ALMOST EVERYTHING go well: I have the cookie at memory, but not
    as a file in hard-disk.
    Don´t worry, I think, It can be pass by code to the Navigate2 (...,headers)
    of the browser control

    And here is the second problem: There is no way to pass it in the 'headers'

    strHeaders = "Cookie: " + cookie.Name + "=" + cookie.Value + "\r\n";
    strHeaders += "Content-Type: application/x-www-form-urlencoded\r\n";

    Because 'headers' parameter is an additional headers collection, so if there
    was already another previous cookie in it, the mine will be ignored, Won't it?

    I´ve checked with a HttpTracer. Because there was this cookie
            Cookie: ASP.NET_SessionId=s1pnuh45i3h2dh55rto23bn1
    My cookie is not passed.

    ¿Any idea?????

    Thanks.


  • Next message: Matthew Wieder: "Re: HELP! CreateProcessWithLogonW issue"

    Relevant Pages

    • Re: Force user to another page
      ... sending ANY output to the client sends the ... session_startdoesn't send headers - all it does is read ... the cookie which the client already sent and initiate the session. ... but I'm learning to parse the error messages & warnings a ...
      (comp.lang.php)
    • Re: If not readdir() then what?
      ... Please go read the NFS spec. ... The only thing an NFS client has in order ... filehandle and a cookie as its arguments. ... The server is expected to return cookies for _each_ ...
      (Linux-Kernel)
    • Re: Best authentication methods for CGI <- PERL -> DBI
      ... Right now one method which seems to be really unsecured, is to take them, check them against the PW/ID stored in the database and permit/deny against that. ... The client javascript code takes the password and MD5 sums it, and sends that as the password along with the cleartext username. ... One cookie is the record id of the user in the database, ... A solution to not use https would be public key encryption. ...
      (perl.dbi.users)
    • Re: Best authentication methods for CGI <- PERL -> DBI
      ... Right now one method which seems to be really unsecured, is to take them, check them against the PW/ID stored in the database and permit/deny against that. ... The client javascript code takes the password and MD5 sums it, and sends that as the password along with the cleartext username. ... One cookie is the record id of the user in the database, ... A solution to not use https would be public key encryption. ...
      (perl.dbi.users)
    • Re: Bypass Authentication
      ... Set-Cookie get established on the Client upon a Successful logon. ... planning on capturing the cookie on Location 3. ... Upon Launching the browser ... "Joe Kaplan" wrote: ...
      (microsoft.public.dotnet.security)

  • Quantcast