views:

25

answers:

1

I'm trying to get around an issue for a customer that have a site developed by a previous developer. The following is the line of code causing the issue:

args.AddParam("REFERER","",Request.UrlReferrer.ToString());

Therefore if you navigate directly to this page using the URL, it returns a null exception error. I know that to fix this the code should first be checking if UrlReferrer is set to null, however I am trying to find a way around this problem without having to change any source. Any help would be appreciated

+1  A: 

No, there is no URL (Querystring) argument that can set the REFERER http header to something. The only way you can do it is to link to the page from another one, and only navigate to it in that way.

Noon Silk
That doesn't work either, there's also a Redirect.aspx page and you can use it as Redirect.aspx?URL=http://myUrl.com and within the code for this there is a line that redirects you to the correct page i.e.Response.Redirect(newUrl);However this still throws the null exception when it tries to get the ReferrerUrl
moorcroft
moorcroft: That seems strange. Is a proxy clearing that field?
Noon Silk
No it's not going through a proxy, I'm testing it on localhost
moorcroft
moorcraft: You may still have a proxy set up locally. I've just tested it here (VS2008, Framework 2.0) and it works. Something else is happening ...
Noon Silk
Perhaps your `args` object is null. What is it?
Noon Silk
Nope it's not null, because I have other arguments that add to it just fine
moorcroft
Well mate, I don't know what to tell you other than I cannot reproduce your problem. I suggest you start with a simple example, in a new project, that demonstrates the issue, and go from there.
Noon Silk
Sorry forgot to mention, It's a VS .Net 2003 project (Framework 1.1, not VS 2008
moorcroft