ASP.NET MVC in subfolder / virtual directory / routing / domain problem

Yesterday I posted the following question, but did not get a useful answer. Maybe I was not clear enough, I'm really sorry.

After hours of searching here and searching the Internet with Bing, I could not solve the following Problem. This should not be a "heavy" problem.

here is my problem

  • I have a domain like http://example.com that points to a virtual directory in my web space, for example http://myprovider.com/VirtualDirectoryName/ .

  • Folder structure on my web space (off course) like this

root

  bin VirtualDirectoryName bin Content Scripts Views Web.config Global.asax 

If I call "http://www.domain.com" now, I get the site without CSS and the link "http://www.domain.com/VirtualDirectoryName/".

I used the standard and almost empty standard "Internet application". So the default routing and all links are created using @ Html.ActionLink.

Please help me, I've tried so many things, but I can't get it to work. In my local environment, I can affect the IIS settings, but (not in the know) i do not have access to the IIS settings of my host.

btw, the provider of the hosting provider is an ASP.NET discount.

Thanks everyone!

+4
source share
4 answers

The problem was a simple routing error. My application was a simple folder in iis, not a virtual directory / application. After installing the folder in the application, the problem disappeared.

0
source

How do you link css files in your html?

If you refer to like this:

 <link href="../../Content/Style.css" rel="stylesheet" type=\"text/css\" /> 

It may not look in the correct directory. Try referencing it like this:

 <link href="/Content/Style.css" rel="stylesheet" type=\"text/css\" /> 

So you are referencing it from the root.

A good way to check is to use the "net" tab in firebug, this will show if they are loading, and if not, where exactly does it try to find them.

0
source

Link your css and javascript this way (using ResolveClientUrl):

 <link href="<%=ResolveClientUrl("/Content/style.css")%>" rel="stylesheet" type="text/css" /> 
0
source

I think you can solve it using web.config in the root, as suggested here How to place an ASP.NET MVC site in a subfolder

0
source

All Articles