handle website sessions in .net
I have one VB.net ClassLibray application.
I have a line of code:
System.Diagnostics.Process.Start("https://stackoverflow.com/")
This will take me to 开发者_开发问答stackoverflow website.
the question is when i close the stackoverflow website how to get a response back to my application ?
ie,
How to handle the sessions of external web pages in .net ?
There is no general way to do this. There is no way to know what process will be started when you call that method.
For example, it might start any installed browser, such as Firefox, IE, Safari, or Opera.
Even if you know what browser it is there is no way to know what the process is. Many new browsers support tabbed UI or run in multiple processes. There is no way to know which process or which tab in a process will handle this URL.
It also isn't clear what you mean by "session". What exactly are you hoping to do here?
The Process.Start function returns a Process object which has a HasExited property. You can simply check this.
Alternatively you can call WaitForExit if you simply want your application to stop until the browser closes (Optionally with a timeout if you for example only want to wait a few minutes before falling back to a default functionality).
精彩评论