开发者

CSS not loading up in ASP.NET site when using view in browser

开发者 https://www.devze.com 2022-12-13 13:37 出处:网络
I have this asp.NET web site that for some odd reason doesn\'t want to load css and script from the plugin I 开发者_运维知识库just wrote. This occurs if I use View in browser option in Visual studio.

I have this asp.NET web site that for some odd reason doesn't want to load css and script from the plugin I 开发者_运维知识库just wrote. This occurs if I use View in browser option in Visual studio. If I preview a sample file in browser directly from file system, it works OK.

I have checked source code of ASP site and it contains both files. In Firefox I even clicked on both hrefs and the content was displayed.

clip from code:

<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    ...
    <link rel="stylesheet" type="text/css" href="plugin/adPlayer/adPlayer.css" />
</head>
<body>
    ...
    <script type="text/javascript" src="plugin/adPlayer/adPlayer.js"></script>
</body>

Any ideas?

Edit: I am using ASP.NET development server for preview.

Edit 2: Installed IIS 5.1. Problem remains. Btw, this only occurs in Firefox browser. There is no request for those CSS and JS files in Firefox.


Are you sure it's not loading it? A few ideas:

  • Clear your browser cache.

  • Look at your IIS log file to see if those files are being requested.

  • Use Fiddler or FireBug to see the HTTP requests and responses.

  • Is that the ASP source or output HTML you posted above? If it's the ASP, check the actual output HTML.

  • Check that the adplayer subdirectory on the web server is accessible to the IIS process user, anonymous user or whatever.

  • This is a long shot, but since those files should be served by IIS not ASP, check that there is nothing in your config that is forcing them into ASP, such as:

    <system.web> <httpHandlers> <add verb="*" path="*.js" type="System.Web.HttpForbiddenHandler" /> </httpHandlers> </system.web>


what happens, wehn you open the css-file in you browser?

CURRENT_URL + plugin/adPlayer/adPlayer.css

is plugin perhaps in your root path? then you need to prepend a slash to your style-href

<link rel="stylesheet" type="text/css" href="/plugin/adPlayer/adPlayer.css" />


Problem solved. For some odd reason, the folder in which the plug-in resided wasn't viable for Firefox. I assume that this is it, as after I created a new folder, and checked out content from subversion and linked it properly, everything started to work just fine.


I know this question is solved, but I fixed my problem by adding mycomputer\iis_iusrs to the security preferences for the folder containing the website's files.

0

精彩评论

暂无评论...
验证码 换一张
取 消