http sessions and .Net Windows Forms

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi,

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

System.Diagnostics.Process.Start(strURLCommand)

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
 
Hi Mark,

System.Diagnostics.Process.Start(strURLCommand)
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
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconcookieauthenticationusinganxmlusersfile.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.

--------------------
 
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
 
Hi Mark,

Did you really need to use the code line?
System.Diagnostics.Process.Start(strURLCommand)

If no, you may try to automation InternetExplorer. 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.InternetExplorer ie;
private void button1_Click(object sender, System.EventArgs e)
{
ie = new SHDocVw.InternetExplorerClass();
ie.Visible=true;
object o = Missing.Value;
ie.Navigate("http://localhost/test/logon/default.aspx",ref o,ref o,ref
o,ref o);
}

private void button2_Click(object sender, System.EventArgs e)
{
object o = Missing.Value;
ie.Navigate("http://localhost/test/logon/srcview.aspx",ref 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.

--------------------
 
Hi,

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

Thanks
 
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.

--------------------
 
Back
Top