How to get current page URL in MVC 3

Andru
Andru
6 Points
3 Posts

Hi,

I am using mvc 3. What is the best way to get the URL of the current page?

Views: 8139
Total Answered: 1
Total Marked As Answer: 0
Posted On: 20-Jun-2015 08:15

Share:   fb twitter linkedin
Answers
Brian
Brian
Participant
536 Points
73 Posts
     

Hi Andru,

Use this

Request.Url.PathAndQuery 

It will work perfectly, especially if you only want the relative Uri (but keeping querystrings)

Posted On: 23-Jun-2015 06:08
banner

Blog

Active User (2)

 Log In to Chat