cheebacat
cheebacat

Reputation: 33

IIS7 adds gibberish to URL, causes 404 for CSS files

I have a C# web application that runs fine when hosted by VisualStudio.

When I host it on IIS, the link to my CSS stylesheet returns a 404 error.

Basically:

http://hostname/Sitename/default.aspx

becomes

http://hostname/Sitename/(S(ubd3fhzfs04ebb1qzfsjlsse))/default.aspx

I dont know what might've changed, but this started happening after a publish a couple of weeks ago.

I have tried deleting the site folder and re-publishing.

I have 2 other applicatins hosted that are also published via VS, and their URLS are normal i.e.

http://hostname/Sitename/default.aspx

From what I can tell, the web.configs and IIS setups are the same for all sites.

Upvotes: 0

Views: 191

Answers (1)

fejesjoco
fejesjoco

Reputation: 11903

That URL contains a session cookie ID, it is caused by a cookieless session (either cookies are disabled and automatic detection kicks in, or you explicitly set up cookieless sessions, or it is caused by a device-specific ASP.NET configuration). It can simply be fixed by changing session settings. However, I would also fix my static file references to be relative instead of absolute, so they wouldn't cause 404 errors in different setups. Cookieless URL's are handled transparently by ASP.NET, so they don't cause 404 errors on their own, only if you have hard-coded absolute URL's, which is bad practice anyway.

Upvotes: 1

Related Questions