开发者

Corrupted headers at Response.Redirect

I have a single user at a website who gets this error:

Object reference not set to an instance of an object.HTTP/1.1 302 Found  
Cache-Control: private  
Content-Type: text/html; charset=utf-8  
Location: /search.aspx?ds=1&s=s%c3%b8ren s%c3%b8rensen  
Server: Microsoft-IIS/7.5  
X-AspNet-Version: 2.0.50727  
X-Powered-By: ASP.NET  
Date: Thu, 25 Nov 2010 10:26:54 GMT  
Content-Length: 177

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="%2fsearch.aspx%3fds%3d1%26s%3ds%25c3%25b8ren+s%25c3%25b8rensen">here</a>.</h2>
</body></html>

The redirect in question is performed here:

protected void btnSearch_Click(object sender, EventArgs e) {
    string strSearch = ss.StringStuff.FixNullString(txtSearch.Text);
    if (strSearch != "") {          
        Document dcFrontpage = new Document(1170);
        int intSearchPageId = ss.NumberStuff.FixNull(dcFrontpage.getProperty("searchPageContentPicker").Value.ToString());
        string strSearchPageUrl = umbraco.library.NiceUrl(intSearchPageId);
        Response.Clear();
        Response.Redirect(strSearchPageUrl + "?ds=1&s=" + strSearch);
    }
}

Sometimes the user is asked if she wants to save the file even though it's a .aspx file and the rest of the time the browser just shows the content above.

I thi开发者_JS百科nk both errors occurs because the text "Object reference not set to an instance of an object." gets inserted into the headers. This, of course, does not belong here and makes the page very invalid and so the browser behaves as described.

I can not reproduce the error, nor can any of my colleagues.

Has anyone seen anything like this before? How can the text be inserted in the headers and why is it just for a single (or very few) user(s)?

Thanks in advance

Edit: I have already thought about the possibility that there is a try-catch somewhere in the code that should be writing out an error that occurs somewhere, but why should this error be put in the beginning of the headers and why should it only occur for very few users?

Besides I have just examined every try-catch in the solution. None of them prints out the error message through a Response.Write.


I suspect there might be a bit of code something like this lurking somewhere. Take out the try-catch. You don't want it, and neither does the person who will end up maintaining it.

try
{
    // Do something
}
catch (Exception ex)
{
    Respose.Write(ex.Message);
}


The error has now been located.
It appears that the user had some strict antivirus settings that caused this error.
When disabling these settings, she could not reproduce the error anymore.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜