Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 789119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:28:29+00:00 2026-05-14T21:28:29+00:00

I have used response.redirect in classic ASP and ASP.NET webforms. However, with MVC 2.0,

  • 0

I have used response.redirect in classic ASP and ASP.NET webforms. However, with MVC 2.0, I am running into something peculiar.

I have a private method in a controller class that is used by multiple controller methods to help load and validate some information. This private method is setup to redirect if a problem is discovered to a generic error message page.

The big problem I am noticing is that the calling controller class and page view attempt to complete rendering and loading before the redirect actually takes place. This is annoying in development because the View throws exceptions that I need to ignore before my generic error page finally loads.

As mentioned above, I am used to the older model of response.redirect which prevented subsequent code on a page from being executed as the new page would then load.

Any help or advice on redirects in MVC would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:28:29+00:00Added an answer on May 14, 2026 at 9:28 pm

    The conventional mechanism to redirect in ASP.Net MVC is to return an object of type RedirectResult to the client. If this is done before your View method is called, your view methods will never be called.

    If you call Response.Redirect yourself, instead of letting Asp.Net MVC’s front controller do that for you, your controller method will continue on until it finishes or throws an exception.

    The idiomatic solution for your problem is to have your private method return a result that your controller can use.

    for example:

    public ActionResult Edit(MyEntity entity)
    {
      if (!IsValid()) return Redirect("/oops/");
      ...
      return View();
    
    }
    
    private bool IsValid()
    {
      if (nozzle==NozzleState.Closed) return false;
      if (!hoseAttached) return false;
      return (userRole==Role.Gardener);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Datagridview in asp.net. I have used custom buttons of up and
I have a fairly standard ASP.Net web application which is used via mobile safari
i have one asp.net project. In this i used session for logged user. If
hello I am having problem related to https:// . I have used FB.getLoginStatus(function(response) function
I have an ASP.NET MVC2 application that uses a parent controller to setup specific
I have developed an asp.net web application containing 40-50 pages. I have implemented logger
We have a URLRewriting module that is using a Response.Redirect in the BeginRequest event
Its a simple login form that I have made using Classic ASP, where the
I am creating timed online test in C# asp.net. I have created it using
I have a do a project for school with classic asp which I ave

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.