ASP MVC based site: IE8 requesting 'null' static resource - asp.net-mvc

I've noticed in my ELMAH log a few times the following error:
The controller for path '/assets/css/null' was not found or does not implement IController.
There's only one place on the site which references this file: inside our _CSS.cshtml view.
<link rel="stylesheet" type="text/css" href="/assets/css/style.css">
How can this somehow turn the 'style.css' into 'null'? I've not actually seen the problem happening but our log file shows that it has, and the user agent string identifies the browser as IE8. I've refreshed the page that is shown as the HTTP_REFERER for this error but can't simulate it myself.
It's a bit mystifying!
Thanks

Related

Middleman gives 404 in Article Page

I'm getting started building out a blog with Middleman using the middleman-blog extension. Everything is working great so far on the home page. The problem occurs when I click on a link to see the full blog post. The full blog post page has no CSS being applied to it. After further inspection, I am receiving a 404 error. I fixed it on Dev Tools by moving 3 levels up in my CSS link href like so:
BEFORE (works in Home Page but not in Article pages)
<link rel="stylesheet" href="stylesheets/global.sass">
AFTER (moving two levels up no longer gives me a 404)
<link rel="stylesheet" href="../../../stylesheets/global.sass">
My question is: What do I need to modify so that Article Pages look for the CSS 3 levels up while the home page remains intact?
In your case, the easiest way would be to use webroot-relative paths.
To recap, you're using a regular relative path...
<link rel="stylesheet" href="stylesheets/global.sass">
If your page is at http://example.com/index.html, then the browser will look for http://example.com/stylesheets/global.sass.
But if your page is at http://example.com/blogs/2013/03/20/blogpost.html, the browser will look for http://example.com/blogs/2013/03/20/stylesheets/global.sass
Now, the solution...
If you add a slash to the beginning of the path, you make that relative path into a webroot-relative path. The web browser will start looking for the file at the webroot...
<link rel="stylesheet" href="/stylesheets/global.sass">
So, regardless of whether your page is at http://example.com/index.html, http://example.com/blogs/2013/03/20/blogpost.html or http://example.com/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/page.html, the browser will, in all cases, look for the file at http://example.com/stylesheets/global.sass.
The Adobe Dreamweaver documentation on linking and navigation explains this a bit more completely.

ASp.NEt MVC :Push new Resources updates of website in web browser

i have developed my website using ASP.MVC3 platform, please provide exact solution for below concerns.
If User visit my website After new resource updates[style changes,script] in our site, they can view only old resources in website .
For getting new resource updates in site they need to manually refresh the page several times for get it to render properly with new changes. This doesn't happen on any several sites.
SO anyone suggest How to avoid refresh the page again and again for getting new updates site in programmatical way. and also suggest any possibility to do this in my site global.axjax file MVC application while website loading?
Please don't tell like this "clear your browser cache "
One of the most common technique people use is to update the reference to the source files by adding random query string in the end of link, like this
<link href="/Content/all.min.css?d=20090107" rel="stylesheet" type="text/css" />
you can do the same for Javascript files. For more details on why this helps, check the following link
What does '?' do in a Css link?

Orbeon : linking ressources (css, images, js) leads to erratic behavior

I'm developing a new webapp based on the orbeon samples. I'm using orbeon 3.9 CE. I got VERY ERRATIC behavior when I use custom ressources. They are placed in following folders :
/orbeon/WEB-INF/resources/config/theme/*.css
/orbeon/WEB-INF/resources/config/theme/*.js
/orbeon/WEB-INF/resources/config/theme/images/*.jpg
In my custom theme file (/orbeon/WEB-INF/resources/config/theme-xnotes.xsl), they are linked like this (a few examples) :
<xhtml:link rel="stylesheet" href="/config/theme/bootstrap.css" type="text/css" media="all"/>
<xhtml:script src="/config/theme/bootstrap.js"/>
<xhtml:link rel="icon" href="/config/theme/images/icone_grue.png" type="image/png"/>
When I point my browser at the application (http://localhost:8080/orbeon), it SOMETIMES work, SOMETIMES doesn't (css are ignored, page transitions are wrong) and SOMETIMES it works partially (css are ok, js not, a few images are ok, others are not and so on)
When I look at the page source code, the links seems to be ok, to take the sames examples as above :
<link rel="stylesheet" href="/orbeon/config/theme/bootstrap.css" type="text/css" media="all">
<script src="/orbeon/config/theme/bootstrap.js">
<link rel="icon" href="/orbeon/config/theme/images/icone_grue.png" type="image/png">
But some links are not valid and point to the root of the application. The main problem is that I just can't make this behavior consistent to isolate the issue(s).
Help really appreciated ! It's driving me crazy...
I don't think there can be more than one GET or POST per request, but per open connection certainly.
However, this might be related to authentication since you mention j_security_check. Can you try to make sure that the CSS and other resources are not protected by form authentication?

resolve url/url.content not fetching the correct path for css and scripts after hosting in IIS6.0

i have hosted my application on IIS 6.0 the view that i wanted to browse is getting fetched in the browser but the css and scripts are not being rendered .
<link href="<%= Url.Content("~/Content/Tree.css")%>" rel="stylesheet" type="text/css" />
in this way i have given the path.
The link tag is properly defined. You are using the Url.Content method with a relative path from the site root which will correctly take into account the virtual directory which could be added when hosting under IIS.
I would recommend you looking at FireBug to see why the path is not found and what response does the server send when the CSS is fetched. Is the file missing? Or is there some other status code returned?

External stylesheet content gets included on page somehow

I've run into a weird issue with a site running ASP.NET MVC on IIS7.
Whenever I do a page refresh (F5), the external stylesheet content gets "injected" into the page itself, instead of the tag pointing to the css file. Example:
<head><link type="text/css" rel="stylesheet" href="external.css" /></head>
Renders as:
<head><style type="text/css">body{ color: #000; }</style></head>
Locally, there is no issue at all, only when it is uploaded to the server.
If I do a hard refresh (Ctrl + F5), it renders as it should, but subsequent requests will not.
I'm inexperienced with IIS7, so I don't know if this issue could be caused by it.
Any help would be appreciated.
Turns out an improperly closed script tag was wrecking havoc with the page.
After fixing it the page renders normally.
Well, this is a weird issue. I don't know if IIS7 has a setting, or a handler that would cause this.
Try using a tool like Fiddler or Live HTTP Headers to verify the external CSS file is actually not being requested at all.

Resources