How to redirect if javascript is disabled in mvc masterpage

How to redirect if javascript is disabled in mvc masterpage

I have a masterpage on which i want to check if user have disabled its javascript then redirect to a simple error.aspx page

Getting Error “CS1026: ) expected” when trying to combing .js files using SquishIt


How to enable/Disable textbox. and also make text box blank on change of value in the drop down list
On Masterpage just add this code.
How to pass data from a jquery dialog back to a controller's action to update the dialog
<noscript> <% Response.Redirect(Url.Action("ActionName","ControllerName")); %> </noscript> 
If user disabled the javascript it will redirect to specific controller action..
How do you set or remove generated label styles from the jQuery Validation plugin?

ASP.NET MVC Trouble getting data and related data to the view. (View Model Pattern?)

Combining ASP.NET MVC and Reverse Proxy with URL Rewrite v2


ASP.NET MVC 2 - Html.EditorFor a nullable type?
The usual way to approach this problem is to redirect a user who has javascript enabled and display the error for the user who has it disabled using the noscript tag..
How to create the custom authorize filter?
 <script type="text/javascript">      location.href = 'pagethatneedsjavascript.aspx';  </script>  <noscript>      This page needs JavaScript enabled!  </noscript> 
Alternatively if your page isn't the first page the user would load in the current session, you could add a link to the page like.
<a href="/linktopage.aspx?js=disabled" onclick="location.href='/linktopage.aspx?js=enabled';return false;">the page</a> 
If the user has javascript disabled, they'll go to the page referenced in the href attribute, if they have it enabled the JavaScript in the onclick attribute will be executed instead.

. You can then on the server side read the querystring variable and redirect if it equals "disabled".
if ( Request.QueryString["js"] == "disabled" ) {     Response.Redirect("error.aspx"); } 
Note that if the page is bookmarkable the user might end up on the page using js=enabled without js actually being enabled..

87 out of 100 based on 87 user ratings 837 reviews