Click here to Skip to main content
15,888,908 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to get Url from browser or how to use webBrowser class?
Posted
Comments
[no name] 11-Sep-13 13:34pm    
Well you could read the documentation... http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx
Sergey Alexandrovich Kryukov 11-Sep-13 19:30pm    
First of all, when you say "WebBrowser class", the question is: which one?! There are many. Platform? Windows? .NET? what? Language?..
Why do you think somebody needs to read your mind? My mind reader is a little wet after the last rain, I cannot use it right away...
—SA

1 solution

Sidmirza wrote:
how to get Url from browser

If you use Windows Forms, use the WebBrowser.Url Propery[^]:
C#
Uri url = yourWebBrowser.Uri;
string urlRepresentedAsString = url.ToString();

If you use WPF, use the WebBrowser.Source Property[^]:
C#
Uri url = yourWebBrowser.Source;
string urlRepresentedAsString = url.ToString();


Sidmirza wrote:
how to use webBrowser class?

If you use Windows Forms, have a look here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx[^]
http://www.dreamincode.net/forums/topic/57191-creating-a-simple-web-browser/[^]
http://www.codespread.com/create-a-browser-in-c-winforms.html[^]

If you use WPF, have a look here:
http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx[^]
http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/web-browser-control-in-wpf/[^]
http://www.c-sharpcorner.com/uploadfile/9f4ff8/build-a-web-browser-in-wpf-and-C-Sharp/[^]
 
Share this answer
 
v4
Comments
Sergey Alexandrovich Kryukov 11-Sep-13 19:32pm    
Excuse me, but where do you see that the user uses System.Windows.Forms? Why not WPF? Where do you see that the user uses .NET at all?
Such questions should not be answered until OP specifies everything...
—SA
Thomas Daniels 13-Sep-13 11:13am    
You're right, the OP could use WPF. But I'm sure that he uses .NET, because I'm not able to find another WebBrowser class than the .NET one.

[EDIT]

I updated my answer.
Sergey Alexandrovich Kryukov 13-Sep-13 12:16pm    
5ed, thank you.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900