I want to get full url, in ASp.NET MVC 4, for example user entered url:
http://localhost:5555/#globalName=MainLines&ItemId=5
And when I try to get this url in Global.asax
, I get only http://localhost:5555/
protected void Application_BeginRequest(object sender, EventArgs e)
{
var url = HttpContext.Current.Request.Url;
}
Thanks
To get the current page URL, PHP provides a superglobal variable $_SERVER. The $_SERVER is a built-in variable of PHP, which is used to get the current page URL. It is a superglobal variable, means it is always available in all scope.
You can use this: <? php $url = 'http://'.($_SERVER['SERVER_NAME']==='localhost')?'localhost/PROJECTNAME':$_SERVER['SERVER_NAME']; echo $url; ?> – DS.
That's impossible. The part that is following the fragment (#
) is never sent to the server in the HTTP request and the server has no way of retrieving it. Fragments can only be accessed by javascript. So if you want to retrieve this value on the server you will have to use javascript to read it and then store it in some hidden field or something so that it gets sent to the server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With