الأحد، 2 سبتمبر 2018

How To Get Current URL?

سبتمبر 02, 2018





Sometimes you need to find current URL by using ASP.NET server side code. That could be for example, if you want to switch user from HTTP to HTTPS protocol you need to find current URL first and then redirect to URL with prefix https://.
To get URL of current page in ASP.NET you can use Request.Url.AbsoluteUri property, like in example code line bellow:
[ C# ]
string CurrentURL = Request.Url.AbsoluteUri;
[ VB.NET ]
Dim CurrentURL As String = Request.Url.AbsoluteUri
ads2

0 التعليقات:

إرسال تعليق

 
Toggle Footer