In the background, the page suddenly error: Resource interpreted as Script but transferred with MIME type text/html
Cause the page JS effect is garbled, after Google, most of the changes are the registry, and my registry does not need to be modified.
This is the article I was looking for before:
Http://stackoverflow.com/questions/12003107/resource-interpreted-as-script-but-transferred-with-mime-type-text-plain-for-l
In fact, in the global file to verify whether to log in, if not logged in to jump to the login page,
If you use
Response.Redirect ("~/login.aspx"); There will be a just error.
If you use
Response.Write ("<script language= ' javascript ' >window.location= '/login.aspx ' </script>"); Normal.
voidApplication_BeginRequest (Objectsender, EventArgs e) { //If you are not logged in, skip to the login page if(context.request.cookies["LoginID"] ==NULL&& Context.Request.PhysicalPath! = Context.Server.MapPath ("~/login.aspx")) { //Context.Response.Redirect ("~/login.aspx"); This notation will be as JS error: Resource interpreted as Stylesheet but transferred with MIME type text/htmlResponse.Write ("<script language= ' javascript ' >window.location= '/login.aspx ' </script>"); //Response.End (); } }
Resource interpreted as Script but transferred with MIME type text/html