Note that there are some explanatory texts on larger screens.

plurals
  1. POResponse.Redirect() Turns Response.RedirectLocation NULL
    primarykey
    data
    text
    <p>I have a group of Asp.Net applications that all share a common HttpModule that contains some code like this:</p> <pre><code>public class MyModule : IHttpModule { public void Dispose() { } public void Init( HttpApplication context ) { context.Error += new EventHandler( context_Error ); } private void context_Error( object sender, EventArgs e ) { var lastError = HttpContext.Current.Server.GetLastError(); doSomeStuffWithError(lastError); var response = HttpContext.Current.Response; var redirect = GetErrorRedirect(lastError); response.Redirect(redirect, true); } } </code></pre> <p>This works totally fine for all of my applications except for one. In the case of the one that doesn't work correctly, response.Redirect(...) doesn't seem to work. Instead of the redirect I expect, Asp.Net is redirecting to its standard error page. I've checked the configuration of this application and don't see anything wrong or significantly different from the other applications.</p> <p>While investigating this issue, I modified the error handler with one more line of code as follows:</p> <pre><code>private void context_Error( object sender, EventArgs e ) { var lastError = HttpContext.Current.Server.GetLastError(); doSomeStuffWithError(lastError); var response = HttpContext.Current.Response; var redirect = GetErrorRedirect(lastError); //setting a break point here, i've verified that 'redirect' has a value in all cases response.Redirect(redirect, true); var wtf = response.RedirectLocation; //inspecting the value of 'wtf' here shows that it is null for one application, but equal to 'redirect' in all others. } </code></pre> <p>When I set a break point on 'wtf' I'm seeing some strange behavior. For applications that work, wtf contains the same value as redirect. However, for my app that isn't working, wtf is null.</p> <p>Anyone have any ideas on what would cause wtf to be null in this way?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload