Tae-Sung Shin
Tae-Sung Shin

Reputation: 20633

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.

Upvotes: 14

Views: 23175

Answers (1)

jdavies
jdavies

Reputation: 12894

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

<%= Request.Url.PathAndQuery %>

Upvotes: 28

Related Questions