http sessions and .Net Windows Forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    http sessions and .Net Windows Forms

    Hi,

    I want to run in my .Net Windows Form this statement

    System.Diagnost ics.Process.Sta rt(strURLComman d)

    to open the browser and navigate to the specified URL.

    The URL is an ASP.Net Web Page with authentication
    mode="Forms". In this way, the browser displaies the
    authentication ASP.Net WEB page, every time the
    application executes the statement.

    I want to display the authentication page only the first
    time.

    Ho can I do?

    Thank's
  • Peter Huang [MSFT]

    #2
    RE: http sessions and .Net Windows Forms

    Hi Mark,

    System.Diagnost ics.Process.Sta rt(strURLComman d)
    the code line will open a new process every time you excute.
    for the design by process, the http session is not same in two process.
    If you want to do so, then the web sites must support cookie.
    You may try to make a test by following the link below.
    Forms Authentication Using An XML Users File

    l/cpconcookieauth enticationusing anxmlusersfile. asp
    You may check Persistent Cookies: option in the example webpage in the link
    above.
    Then you may using the IE to open the website many times without login.

    Did I misunderstand your meaning?
    Can you tell me what aim do you want to achieve, so I can help you.


    Regards,
    Peter Huang
    Microsoft Online Partner Support
    Get Secure! www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

    --------------------[color=blue]
    >Content-Class: urn:content-classes:message
    >From: "Mark" <Info@SIRIOInfo rmatica.it>
    >Sender: "Mark" <Info@SIRIOInfo rmatica.it>
    >Subject: http sessions and .Net Windows Forms
    >Date: Wed, 17 Sep 2003 08:25:58 -0700
    >Lines: 19
    >Message-ID: <040c01c37d2f$f e83a0c0$3101280 a@phx.gbl>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="iso-8859-1"
    >Content-Transfer-Encoding: 7bit
    >X-Newsreader: Microsoft CDO for Windows 2000
    >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    >Thread-Index: AcN9L/6DqIUJl7YORoaLP mkKDzwEwQ==
    >Newsgroups: microsoft.publi c.dotnet.genera l
    >Path: cpmsftngxa06.ph x.gbl
    >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:108843
    >NNTP-Posting-Host: TK2MSFTNGXA05 10.40.1.49
    >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    >
    >Hi,
    >
    >I want to run in my .Net Windows Form this statement
    >
    >System.Diagnos tics.Process.St art(strURLComma nd)
    >
    >to open the browser and navigate to the specified URL.
    >
    >The URL is an ASP.Net Web Page with authentication
    >mode="Forms" . In this way, the browser displaies the
    >authenticati on ASP.Net WEB page, every time the
    >application executes the statement.
    >
    >I want to display the authentication page only the first
    >time.
    >
    >Ho can I do?
    >
    >Thank's
    >[/color]

    Comment

    • Mark Mark

      #3
      RE: http sessions and .Net Windows Forms

      Thanks Peter for your answer.

      The choice of persistent cookie is a good idea, even if this can, in
      some way, to avoid the problem and not to resolve it. In truth I tried a
      way in order to capture the session and to maintain it "while still
      alive" the entire time necessary, also after the closing of the browser,
      while mine .Net Windows Form is in execution. Although that, the
      solution from suggested you, seems to be only the possible one.

      Thanks newly

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Peter Huang [MSFT]

        #4
        RE: http sessions and .Net Windows Forms

        Hi Mark,

        Did you really need to use the code line?
        System.Diagnost ics.Process.Sta rt(strURLComman d)

        If no, you may try to automation InternetExplore r. Here is my code sample.

        Make a reference to the Microsoft Internet Controls by opening add
        reference dialog and selecting COM/Microsoft Internet Controls
        SHDocVw.Interne tExplorer ie;
        private void button1_Click(o bject sender, System.EventArg s e)
        {
        ie = new SHDocVw.Interne tExplorerClass( );
        ie.Visible=true ;
        object o = Missing.Value;
        ie.Navigate("ht tp://localhost/test/logon/default.aspx",r ef o,ref o,ref
        o,ref o);
        }

        private void button2_Click(o bject sender, System.EventArg s e)
        {
        object o = Missing.Value;
        ie.Navigate("ht tp://localhost/test/logon/srcview.aspx",r ef o,ref o,ref
        o,ref o);
        //this one will not need to get authenticated again if you have gotten in
        the last page.
        }

        Did this does the job for you?

        Regards,
        Peter Huang
        Microsoft Online Partner Support
        Get Secure! www.microsoft.com/security
        This posting is provided "as is" with no warranties and confers no rights.

        --------------------[color=blue]
        >From: Mark Mark <info@sirioinfo rmatica.it>
        >References: <nI6AgoZfDHA.23 56@cpmsftngxa06 .phx.gbl>
        >X-Newsreader: AspNNTP 1.50 (ActionJackson. com)
        >Subject: RE: http sessions and .Net Windows Forms
        >Mime-Version: 1.0
        >Content-Type: text/plain; charset="us-ascii"
        >Content-Transfer-Encoding: 7bit
        >Message-ID: <e5SFzFbfDHA.55 6@TK2MSFTNGP11. phx.gbl>
        >Newsgroups: microsoft.publi c.dotnet.genera l
        >Date: Wed, 17 Sep 2003 23:52:37 -0700
        >NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
        >Lines: 1
        >Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
        >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:109000
        >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
        >
        >Thanks Peter for your answer.
        >
        >The choice of persistent cookie is a good idea, even if this can, in
        >some way, to avoid the problem and not to resolve it. In truth I tried a
        >way in order to capture the session and to maintain it "while still
        >alive" the entire time necessary, also after the closing of the browser,
        >while mine .Net Windows Form is in execution. Although that, the
        >solution from suggested you, seems to be only the possible one.
        >
        >Thanks newly
        >
        >*** Sent via Developersdex http://www.developersdex.com ***
        >Don't just participate in USENET...get rewarded for it!
        >[/color]

        Comment

        • Mark Mark

          #5
          RE: http sessions and .Net Windows Forms

          Hi,

          I would not want to use the COM technology. My intention is that one to
          produce .Net managed code.

          Thanks

          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          • Peter Huang [MSFT]

            #6
            RE: http sessions and .Net Windows Forms

            Hi Mark,

            Can you tell me what is aim of your project?
            Or the cookie is the way your may need to use.

            Regards,
            Peter Huang
            Microsoft Online Partner Support
            Get Secure! www.microsoft.com/security
            This posting is provided "as is" with no warranties and confers no rights.

            --------------------[color=blue]
            >From: Mark Mark <info@sirioinfo rmatica.it>
            >References: <HJJIvpbfDHA.15 48@cpmsftngxa06 .phx.gbl>
            >X-Newsreader: AspNNTP 1.50 (ActionJackson. com)
            >Subject: RE: http sessions and .Net Windows Forms
            >Mime-Version: 1.0
            >Content-Type: text/plain; charset="us-ascii"
            >Content-Transfer-Encoding: 7bit
            >Message-ID: <#WdZd4bfDHA.34 64@TK2MSFTNGP11 .phx.gbl>
            >Newsgroups: microsoft.publi c.dotnet.genera l
            >Date: Thu, 18 Sep 2003 01:23:17 -0700
            >NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
            >Lines: 1
            >Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
            >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:109007
            >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
            >
            >Hi,
            >
            >I would not want to use the COM technology. My intention is that one to
            >produce .Net managed code.
            >
            >Thanks
            >
            >*** Sent via Developersdex http://www.developersdex.com ***
            >Don't just participate in USENET...get rewarded for it!
            >[/color]

            Comment

            Working...