I have such script on my _LyoutView:
<noscript>
<meta http-equiv="refresh" content="0; URL=/Noscript">
</noscript>
But when user with javascript disabled redirected to that page, the infinity request of that page taking place because that page contains this code above as well.
So i just thought may be there is some things out of the box in ASP.NET MVC that can help?
Basically i want that that code from _LyoutView to be added to all views except Noscript view.
i can go like that on _LyoutView:
@if (ViewContext.Controller.ValueProvider.GetValue("action").RawValue != "Noscript")
{
<noscript>
<meta http-equiv="refresh" content="0; URL=/Noscript">
</noscript>
}
But may be there is more better way of doing that?
You can check the
RawUrlproperty of theRequestobject to see if it contains the term “Noscript” which I’m assuming won’t be part of the URL unless we’re on that page.