please help me to get the URL from the address bar.
when i write www.google.com in my address bar my application in c# return the value of URL that is www.google.com

please help me to write this code.

Thanks in Advance

Is this meant to be an ASP.Net web-form application or a C# windows-form application?

If it's a web-form application then:
1)It should have been posted in the ASP.Net forum
2) I'm not really sure how to get the value of the address bar if it's an URL outside of your site (such as google) but you can get the query string of the URL leading to your ASP.Net page (ie: www.yoursite.com?query=value by using

string myQuery = ClientQueryString;

If you're using a webBrowser control in a windows-forms application you can use the following to get the current URL from the webBrowser component but it'd be somewhat pointless since using a webBrowser component, the navigation would be based off another text input component of your windows form and you could simply get the info from there:


Don't know if either of those help, the question wasn't exceedingly clear to me sorry :( Please remember to mark the thread as solved if it does get resolved though.

I am using c# application not asp.net.if u give me some sample code i will be so thankful to u.

Unfortunately what you got from me before is about as good as I can do at the moment, sorry :( Maybe someone else will be more insightful than me but I'm off to sleep.

Good luck though :)

i suppose u r using a button "GO" to run the URL
if so... just add the below lines to click event of that button:



Can share the source code with me?

I am doing this too.

Thanks alot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.