Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 15, 2009 05:02 AM by KeFang Chen - MSFT
Sep 11, 2009 10:08 AM|LINK
I'm having some problems with a css link in the master page after deploying a ASP.NET MVC application to a shared hosting server.
I'm using the default project that visual studio creates for an MVC application.
In Site.Master the link for the css file is
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
but when running the project in VS2008 this is rendered to the browser as
<link href="Content/Site.css" rel="stylesheet" type="text/css" />
However, after deploying the site to a remote server with IIS 7.0 the same link is rendered has
<link href="../Content/Site.css" rel="stylesheet" type="text/css" />
Why is this happening? Any Ideas?
master page programatic
Sep 11, 2009 11:07 AM|LINK
Are you sure you've deployed the same masterpage? Even if you have, you'd almost always want to use this:
<link href='/content/site.css' rel='stylesheet' type='text/css' />
Sep 11, 2009 01:15 PM|LINK
I'm not sure if this is your issue, but I believe the preferred way is to use
<link href="<%= Url.Content("~/Content/Site.css") %>" rel="stylesheet" type="text/css" />
Which will keep things working when deployed to a virtual directory.
Sep 11, 2009 01:35 PM|LINK
Thanks for your reply!
I'm using the masterpage from the default template.
But it seems that this is just a side effect of something else,
Actually what is happening is that when I do "/" request like «http://www.mydomain.com/» I'm allways redirected to
And the same happens if I request the css directly!!!!
If I request http://www.mydomain.com/Content/Site.css I'm beeing redirected to
Sep 11, 2009 01:38 PM|LINK
I forgot to mention two additional facts:
a request to
http://www.mydomain.com/Home/About works ok (although without css)
http://www.mydomain.com/Home/Index also works ok (although without css)
Sep 11, 2009 02:52 PM|LINK
For some reason, the content folder or the root of the website is being protected by forms authentication. This is apparent by the fact that it's redirecting to the login form. Check the root's web.config or if the content folder has a web.config (for some
reason) to see if there's any weird forms authentication rule set. Also, did you modify the default routes in any way?
Sep 11, 2009 04:21 PM|LINK
Sep 11, 2009 04:36 PM|LINK
I have a some problem which i mentioned below. This information raised when I try to send any Post. Please tell me the solution.
Either this forum does not exist or you are not allowed to post.
Apart from this I'am new user in MVC Framework application, basically I am a C# developer. I also tried lot's of example in MVC.
But may I want to create a simple application in which user can take value fron Field and send into database's table using connection String. (I.e SqlExpress 2005)& aslo do Insert Update & delete working..
Thanks and Ragards in advance
Sep 15, 2009 05:02 AM|LINK
Based on your description, if you haven't read some Tutorial about MVC, you can take a look at the following websites.