Resource interpreted as Script but transferred with MIME type text/html

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.