BeanSoftware Logo
 

 
ASP.NET Database Search Control
 
 

 
 Home
    Shop
    Advertise
    Write For Us
    Affiliate
    Newsletter
    Contact

How To Get Current URL?

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



Related articles:

1. How To Find Referrer URL in ASP.NET?
2. Visitor Informations From Request.ServerVariables Collection

FAQ toolbar: Submit FAQ  |  Tell A Friend  |  Add to favorites  |  Feedback



Copyright © 2002-2008 Bean Software. All rights reserved.