Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to obtain the current url [duplicate]

Tags:

c#

asp.net

Possible Duplicate:
How to get the URL of the current page in C#

If I am in a page say http://myweb/folder/obtain.aspx?thevalue=3 , how can i determine if the url contains obtain.aspx?thevalue in c#?. I just need to check whether the user landed on this particular page.

PS: I guess I dont really need to check for the ?thevalue but just the obtain.aspx

like image 826
user710502 Avatar asked Nov 18 '11 16:11

user710502


1 Answers

Try this:

//gets the current url
string currentUrl = Request.Url.AbsoluteUri;

//check the url to see if it contains your value
if (currentUrl.ToLower().Contains("obtain.aspx?thevalue"))
    //do something
like image 174
James Johnson Avatar answered Oct 19 '22 01:10

James Johnson