0

Good Day All

i have an asp.net 4.5 application. i have hosted it on IIS 7.5 in Windows Server 2008. My application has different folders within it and some are for JS and some are for CSS and etc.. and they are inside a directory named "Shared" in my problem and most of the things especially the css , images etc they are reference like this

 <link href="../Shared/assets/css/bootstrap.css" rel="stylesheet"/> 
 <link rel="apple-touch-icon" sizes="57x57" href="../Shared/assets/ico/apple-touch-icon-57x57.png">

now when i host this Project i have issues with CSS and images because they are not retrieved. i use Fiddler to check what is happening and i realised that after i hosted the application now Fiddler reports a 404 error on the following path

** http://myiisreserver/Shared/assets/css/bootstrap.css**

there are many of them , this is just an Example. now you can see it it can see the server , but instead of adding my Application or website name , it add the Directory within my application. So basically it should look like this

http://myiisreserver/MyWebapplication/Shared/assets/css/bootstrap.css

What could be the Problem.

Thanks

3
Contributors
2
Replies
6
Views
3 Years
Discussion Span
Last Post by JorgeM
0

I am not too fimilar with asp.net but with mvc I know that shared assets like this should be in the Content directory.

Sorry if this doesnt help much.

0

Its a simple path issue for the browser. the "../" is telling the browser to find this file by moving up to the parent directory, then accross to the Shared directory and continue the path listed. This is only going to work at the first level set of folders off the root. Once you get into a second level set of folders, this "../" path isnt going to work.

Another option is to provide the path off of the root. For example, if "shared" folder is a first level folder off the root, you can specificy this path from any page on your site regardless where the page is and the browser will be able to find the target page.

<link href="/Shared/assets/css/bootstrap.css" rel="stylesheet"/> 
 <link rel="apple-touch-icon" sizes="57x57" href="/Shared/assets/ico/apple-touch-icon-57x57.png">
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.