When I get referrer url, IIS 7 throws an exception. My code like this:
var referrer = Request.UrlReferrer == null ? null : Request.UrlReferrer.AbsoluteUri;
Application throws an ArgumentException with error message,
“Value does not fall within the expected range.”
There is no problem in IIS 6.
This exception occurs when the page is navigated with “Response.Redirect”
Application main page has an Response.Redirect method according to role of current user. User main page throws this exception.
How can get Referrer URL in IIS 7.
Thanks,
Ran into similar problem when I tried to access the request object from a System.Threading.Task launched in the request processing.
I’m using the task to reduce response time – in my case most of the processing can be performed after request is sent.
That is, I had something like:
I’ve extracted UrlReferrer (and other this.Request.stuff that I needed) in delayed processing) into a separate “closure” variable (I’ve chosen them to have the very basic types):
That worked for me.