Nick
Nick

Reputation: 71

Get the current URL

I'm trying to set a variable to the current URL using:

Dim url As String = HttpContext.Current.Request.url.AbsoluteUri

Which is returning:

http://localhost/xxxxx2015/xxxx.asmx/xxxx

This seems to be the file name followed by the web function name.

What it's supposed to return/what it's displaying in IE is:

http://localhost/xxxxx2015/Default.aspx?form=xxxx

Why is this?

Upvotes: 0

Views: 657

Answers (1)

Hans Kesting
Hans Kesting

Reputation: 39339

You are apparently in a WebRequest, so the current request is the request for that method. However, it is sent from some page, so possibly a "referrer" is set with the URL you are looking for.

See Getting the HTTP Referrer in ASP.NET for more details on how to get it. Basically: use Request.UrlReferrer

Upvotes: 1

Related Questions