user1509283
user1509283

Reputation: 73

Get the current Url of web browser in C#

How can i get the current url (the opened url in web browser) in a text box ?

for example:

webBrowser1.Url= new Uri("http://stackoverflow.com");

and my browser opened the link !!

Now I want to get the url (http://stackoverflow.com) in a text box

regards.

Upvotes: 2

Views: 19260

Answers (2)

Daniel A. White
Daniel A. White

Reputation: 190907

yourTextBox.Text = webBrowser1.Url.ToString();

Upvotes: 7

Zaki
Zaki

Reputation: 5600

Result : http://localhost:1302/TESTERS/Default6.aspx
string url = HttpContext.Current.Request.Url.AbsoluteUri;

result : /TESTERS/Default6.aspx
string path = HttpContext.Current.Request.Url.AbsolutePath;


result : localhost
string host = HttpContext.Current.Request.Url.Host;

Upvotes: 1

Related Questions