How can code go past response.redirect?

I have the following code block. I'm confused how code can get past

Response.Redirect("~..")

Indeed it is. I thought that any lines that went through this would not automatically execute. Am I missing something here? I believe that the debugger actually executes the following lines.

    public ActionResult Index()
    {
        Response.Redirect("~/Default.aspx", true);

        string year =
           Utils.ConvertCodeCampYearToActualYear(
               Utils.GetCurrentCodeCampYear().ToString(CultureInfo.InvariantCulture));
        var viewModel = GetViewModel(year);
        return View(viewModel);
    }
+5
source share
2 answers

All Response.Redirect()(really) set the location=response header to the specified URI and set the http status to 302 Found. He also writes a little HTML stub in response with a link to the new URI, but it's just a decoration.

, , bool, . bool true, , , ThreadAbortException .

+4

return . . Redirect:

return Redirect("~/Default.aspx");
+8

All Articles