繁体   English   中英

在C#中获取当前的Web浏览器URL

[英]Get the current Url of web browser in C#

如何在文本框中获取当前URL(Web浏览器中打开的URL)?

例如:

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

我的浏览器打开了链接!!

现在我想在文本框中获取URL(http://stackoverflow.com)

问候。

yourTextBox.Text = webBrowser1.Url.ToString();
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;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM