TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
3
557
This page isn’t working right nowfof.extranet.nationalgrid.com redirts
Nov 23 2020 11:29 AM
Hi All,
Hope all are doing Good!!.
I am going to make a Custom Error page in MVC application,already my application is hosted in Azure portal.
I try to build a code in VS and working in Local good but Hosted in Azure is getting error like below
This page isn’t working
fof.extranet.nationalgrid.com redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
Please help me to reslove the issue,
I am creating on error controller like below code
and i am creating respective Index View and Http404 view. and http500
public
class
ErrorController : Controller
{
//
// GET: /Error/
[HandleError]
public
ActionResult Index()
{
return
View();
}
public
ActionResult http404()
{
Response.StatusCode = 404;
Response.TrySkipIisCustomErrors =
true
;
return
View();
}
public
ActionResult http500()
{
Response.StatusCode = 500;
Response.TrySkipIisCustomErrors =
true
;
return
View();
}
This is the Http404View...
@{
ViewBag.Title =
"http404"
;
}
<h2>http404</h2>
<h1> Displaying Custom error page</h1>
and adding Web.Config file like below
<customErrors mode=
"On"
defaultRedirect=
"~/Error/"
>
<error statusCode=
"404"
redirect=
"~/Error/http404"
/>
<error statusCode=
"500"
redirect=
"~/Error/http500"
/>
</customErrors>
and Adding Global.Asax file like below code
protected
void
Application_Error(
object
sender,EventArgs e)
{
Exception exce = Server.GetLastError();
Response.Clear();
HttpException httpexception = exce
as
HttpException;
RouteData route =
new
RouteData();
var urlHelper =
new
UrlHelper(HttpContext.Current.Request.RequestContext);
route.Values.Add(
"controller"
,
"Error"
);
if
(httpexception!=
null
)
{
switch
(httpexception.GetHashCode())
{
case
404:
route.Values.Add(
"action"
,
"http404"
);
break
;
case
500:
route.Values.Add(
"action"
,
"http500"
);
break
;
}
Server.ClearError();
Response.TrySkipIisCustomErrors =
true
;
IController cntrl =
new
ErrorController();
Response.Redirect(
"~/Error/http404"
);
cntrl.Execute(
new
RequestContext(
new
HttpContextWrapper(Context), route));
}
and i am commented below line in Filterconfig.cs
public
static
void
RegisterGlobalFilters(GlobalFilterCollection filters)
{
// filters.Add(new HandleErrorAttribute());
}
Could you please help me and give any Suggissions,how to resolve this issue it is in critical now. please.....
Regards,
Reply
Answers (
1
)
image slider by using asp.net
error : ; expected in a line that is deleted from class file