Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can code go past response.redirect?

I've got the following code block. I'm confused how the code can go past the

Response.Redirect("~..")

Indeed it does. I thought any lines past that would automatically not execute. Am I missing somethig basic here? I find the debugger actually executing the next 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);
    }
like image 526
Peter Kellner Avatar asked Mar 29 '13 16:03

Peter Kellner


1 Answers

You need to return it. It's a function. In your case you can use Redirect:

return Redirect("~/Default.aspx");
like image 86
mattytommo Avatar answered Oct 22 '22 12:10

mattytommo