Ehsan Sadeghi
Ehsan Sadeghi

Reputation: 35

Access to content of a process information

I create an instance of IE with this code:

System.Diagnostics.Process p = System.Diagnostics.Process.Start("IEXPLORE.EXE",
@"http://www.asnaf.ir/moreinfounit.php?sSdewfwo87kjLKH7624QAZMLLPIdyt75576rtffTfdef22de=1&iIkjkkewr782332ihdsfJHLKDSJKHWPQ397iuhdf87D3dffR=2009585&gGtkh87KJg89jhhJG75gjhu64HGKvuttt87guyr6e67JHGVt=117&cCli986gjdfJK755jh87KJ87hgf9871g00113kjJIZAEQ798=0a26e8ea07358781d128aa4bc98dd89a");

I want to get the contents of the opened window. Is it possible to read the HTML content by this process?

Upvotes: 0

Views: 175

Answers (4)

Rajesh Subramanian
Rajesh Subramanian

Reputation: 6490

Use following COde,

using (var client = new WebClient())
{
    string result = client.DownloadString("http://www.asnaf.ir/moreinfounit.php?sSdewfwo87kjLKH7624QAZMLLPIdyt75576rtffTfdef22de=1&iIkjkkewr782332ihdsfJHLKDSJKHWPQ397iuhdf87D3dffR=2009585&gGtkh87KJg89jhhJG75gjhu64HGKvuttt87guyr6e67JHGVt=117&cCli986gjdfJK755jh87KJ87hgf9871g00113kjJIZAEQ798=0a26e8ea07358781d128aa4bc98dd89a");
    // TODO: ur logice here
}

Upvotes: 1

george.zakaryan
george.zakaryan

Reputation: 980

no. your processes run in different virtual addressing spaces. That would have been a serious security vulnerability if you could have read the memory space allocated by another process.

Edit: Consider using something like a WebBrowserControl in your original process. That way you cold easily retrieve the page it displays.

Upvotes: 0

Gregor Primar
Gregor Primar

Reputation: 6805

You should use WebClient class to retrieve web page content. Check this link:

http://msdn.microsoft.com/en-us/library/system.net.webclient(v=vs.80).aspx

Upvotes: 0

Thorsten Dittmar
Thorsten Dittmar

Reputation: 56707

It might be possible, but I'd actually use a HttpWebRequest to obtain the HTML content. If you really just want to get the HTML content for a given http-URL, using IE as a separate process is definitely not the way to go.

Upvotes: 0

Related Questions