Redirect to error page from ajax call in ASP.net MVC

Manta

In a MVC app with an error page Error.cshtml located in the Shared folder, how to redirect on this page in case on error returned by the ajax call ?

$.ajax({
    //Some stuff here...
    error: function (jqXHR, textStatus, errorThrown) {
        window.location = "???????";
    }
}
Rahul

Just add your controller name followed by your action name - like this /[ErrorController]/[ErrorActionName] this might solve your issue - Thanks

Don't forget the forward slash

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Validation error from model on ajax call asp.net MVC

ASP MVC redirect to error page from controller

Redirect to new page from Server for ASP.Net MVC Ajax Request

ASP.NET MVC SqlException does not redirect to error page

jQuery Ajax Call returns error : ASP.NET MVC

Redirect to HTTPS Error - ASP.NET MVC

Redirect Error in ASP.NET MVC 5

ajax call with jquery asp.net mvc

Redirect to View from AJAX call on error

Redirect to Home/Error View Page in ASP.NET Core 2.0 MVC

Call Controller Method Which Return View With Ajax Call From Asp.net View Page

ASP.NET MVC Ajax Error handling

C# & ASP.NET MVC : call a view with ajax call

Using jQuery to directly call ASP.NET AJAX page methods -- 500 (Internal Server Error)

Redirect Page based on dropdown information in ASp.NET mvc

Redirect to page OnActionExecuting method ASP.NET Core 5 MVC

Asp.net mvc Redirect to same page after login

ASP.NET MVC 3 Redirect Requests to Root Page

Asp.Net MVC - redirect to same page without passing parameter

How to have AJAX error direct to Developer Exception Page in ASP.NET Core MVC?

Redirect to another page in ajax call

Ajax call after redirect page

ASP.NET Core MVC controller receives null for input parameter from ajax call

How to call api from view using jQuery and ajax in an ASP.NET Core MVC project?

ASP.NET MVC Passing a double to an action from ajax call (I'm receiving a null)

How to call method of a controller from View without using ajax in ASP.NET MVC?

How can I get my Popup to close on submit button from AJAX call in ASP.NET MVC?

ASP.NET MVC Redirect to target page or redirect to previous page after login

Ajax call showing error when call ActionResult in MVC.NET