Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current url value in View

I have following Url:

customer/login?ReturnUrl=home

How can I get this string in my view? I tried

RouteData.GetRequiredString("action")

But it does not return full string. Any help will be appreciated.

like image 919
Tae-Sung Shin Avatar asked Sep 06 '11 17:09

Tae-Sung Shin


People also ask

How to fetch current page URL?

If you're using JavaScript in the browser you can get the full current URL by using window. location. href .

How can I get current URL in asp net core?

To get the current URL I am using the following C# instruction: Uri address = new Uri(Request. Host.


1 Answers

Use the HttpRequest.Url.PathAndQuery Property to retrieve the absolute path and query like so:

<%= Request.Url.PathAndQuery %>
like image 159
jdavies Avatar answered Oct 02 '22 11:10

jdavies