Directory Permissions MVC 3 .Net4

Discussion in 'Site Programming, Development and Design' started by 00108790, Mar 7, 2011.

  1. Hey,

    I am currently having issues trying to use CSS and Images in my website.
    This can be seen here: http://mypulset.w05.Winhost.com/mpt/

    I am able to see all images and content on my local host (VS2010), however when I try to deploy it I get the above results.

    I have looked extensively around for the solution for this problem for the last two weeks and have been unable to solve it. Firstly I thought it might be a Url.Routing issue but when I changed the code to a Url.Content method I have been given the same results.

    Code of my CSS for example:
    Code:
       <link href="<%= Url.Content("~/Content/Site.css") %>" rel="stylesheet" type="text/css" />
    Other posts has had me look at the Web.Config, I believe that I have set all nessecary permissions for it to work. Some posts suggested that any folders other than the Application folders main structure need to be set as a Virtual Folder. Tried it, didn't work. Does anyone have any knowedlge of why this could be going wrong?

    Here is the Web.config incase anyone finds anything suspicious,

    Web.Config:
    Code:
    
    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=152368
      -->
    <configuration>
    
      <configSections>
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        </sectionGroup>
        
      </configSections>
      
     
      
    	<system.webServer>
    		<handlers>
    			<remove name="UrlRoutingHandler"/>
    			<remove name="BlockViewHandler"/>
           
    		 <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
          <add name="Parse CSS Files" preCondition="integratedMode" verb="GET" path="*.css" type="System.Web.UI.PageHandlerFactory" />
        </handlers>
    	</system.webServer>
    	<connectionStrings>
      <add name="ApplicationServices" connectionString="Data Source=tcp:s04.Winhost.com;Initial Catalog=DB_20749_mst;User ID=DB_20749_mst_user;Password=*****;Integrated Security=False;"
       providerName="System.Data.SqlClient" />
      <add name="DB_20749_mstConnectionString" connectionString="Data Source=s04.Winhost.com;Initial Catalog=DB_20749_mst;User ID=DB_20749_mst_user"
       providerName="System.Data.SqlClient" />
     </connectionStrings>
    	<system.web>
    
    		<compilation debug="true" targetFramework="4.0">
    
          <buildProviders>
            <!-- So we can map paths correctly in css files -->
            <add extension=".css" type="System.Web.Compilation.PageBuildProvider" />
          </buildProviders>
          
    			<assemblies>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    				<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    				<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies>
    		</compilation>
       
        <authentication mode="Forms">
    			<forms loginUrl="~/Account/LogOn" timeout="2880"/>
    		</authentication>
    		<membership>
    			<providers>
    				<clear/>
    				<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
    			</providers>
    		</membership>
    		<profile>
    			<providers>
    				<clear/>
    				<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
    			</providers>
    		</profile>
    		<roleManager enabled="false">
    			<providers>
    				<clear/>
    				<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
    				<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
    			</providers>
    		</roleManager>
    		<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
    			<namespaces>
    				<add namespace="System.Web.Mvc"/>
    				<add namespace="System.Web.Mvc.Ajax"/>
    				<add namespace="System.Web.Mvc.Html"/>
    				<add namespace="System.Web.Routing"/>
    			</namespaces>
    		</pages>
    	</system.web>
    	<runtime>
    		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    			<dependentAssembly>
    				<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
    				<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
    			</dependentAssembly>
    		</assemblyBinding>
    	</runtime>
    	<system.serviceModel>
    		<bindings/>
    		<client/>
    	</system.serviceModel>
    </configuration>
    
    
    
    I am entirely greatful if anyone finds any remote reason!

    Thanks in advance!
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    This does not appear to be a permission issue but a path issue. Make sure that the CSS file is uploaded to the path you set it for. Check the path again for the CSS and if possible try using the full server path.
     
  3. Can you try removing the ~ from the path? It's really just having problems with the path finding the CSS file, but I think that should be it.
     
  4. The Image and CSS is defiantly uploaded. I tried removing the ~ and it made no difference unfortunately. I find it so strange that it is working in a local host development environment and not on a shared host, something so simple.

    I don't suppose anyone else has any other suggestions? :(

    Thanks in advanced.
     
  5. I have uploaded my CSS and Images to a different host and I am using a link to them. This works with no problems.

    When I try to access the files in the directory within my application it does not allow it. 404 is reported back to the browser.

    If this helps anyone..
     
  6. Ray

    Ray

    As a test for now try inputting the full server path.
     
  7. I did, unfortunately it didn't work. It just gives me the same 404 Error.:eek:
     
  8. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  9. Last edited by a moderator: Oct 14, 2015
  10. Ray

    Ray

    There is something in your web.config file that is calling on an object and it cannot find it. And I'm afraid I do not know what it is. Go through your web.config file and check the objects it is referencing. Make sure it is coded to the correct path.
     

Share This Page