最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

.net - CSS not loading up in ASP.NET site when using view in browser - Stack Overflow

programmeradmin0浏览0评论

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.

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.

Share Improve this question edited Dec 11, 2009 at 7:18 Vladimir Kocjancic asked Dec 10, 2009 at 10:18 Vladimir KocjancicVladimir Kocjancic 1,8424 gold badges22 silver badges35 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 2

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 myputer\iis_iusrs to the security preferences for the folder containing the website's files.

发布评论

评论列表(0)

  1. 暂无评论