Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You must call the redirect always with <code>endRespose=true</code> or else any hacker can see whats on the page by simple hold the redirect.</p> <p>To prove that I use the <a href="https://addons.mozilla.org/en-us/firefox/addon/noredirect/" rel="nofollow noreferrer">NoRedirect</a> plugin for Firefox to hold the redirect. Then I test the two cases and here is the results:</p> <p>I have a simple page with that text inside it</p> <pre><code>&lt;form id="form1" runat="server"&gt; &lt;div&gt; I am making a redirect - you must NOT see this text. &lt;/div&gt; &lt;/form&gt; </code></pre> <p>and then on Page load try to make the redirect with both cases:</p> <p>First case, using the Complete Request();</p> <pre><code> try { // redirect with false that did not throw exception Response.Redirect("SecondEndPage.aspx", false); // complete the Request HttpContext.Current.ApplicationInstance.CompleteRequest(); } catch (Exception x) { } </code></pre> <p>and there boom, you can see whats inside the page ! <img src="https://i.stack.imgur.com/4ku7X.gif"></p> <p>And second case </p> <pre><code>try { // this is throw the ThreadAbortException exception Response.Redirect("SecondEndPage.aspx", true); } catch (ThreadAbortException) { // ignore it because we know that come from the redirect } catch (Exception x) { } </code></pre> <p>Nothing shown now. <img src="https://i.stack.imgur.com/Ko6vz.gif"></p> <p>So if you do not like a hacker to see whats on your page, <strong>you must call it with endResponse to true</strong> and stop what other processing is made -eg return from function and not continue.</p> <p>If for example you check if the user is authenticated he can see that page or if not he must redirect to login, and even in the login if you try to redirect him with endResponse to false, then holding the redirect the hacker can see - what you believe that can not because you use the Redirect.</p> <p><strong>My basic point</strong> here is to show the security thread that exist if you are not stop to send data back to the browser. The redirect is a header and instruction to the browser, but at the same time you need to stop send any other data, you must stop send any other part of your page.</p>
    singulars
    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.
    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