开发者

ASP.net webdevelopment problem with web.config(?) on IIS7

SOLUTION: <allow users="*"/> changed to <allow users="?"/> did the trick for me.

I have a problem that started to occur when i moved my asp.net website to my webserver (Windows Webserver 2008 R2 - IIS7).

I use VS2010 and run the project asp.net configuration and set deny all on root folder on my website.

Then when accessing the website externally i was correctly forwarded to /Account/Login.aspx but then the css file was not loaded.

So i added a allow all on the /Styles folder.

Still same problem.

If i login and then logout the css seems to load..

I dont really know what to look for here, is it a web.config problem, iis7 config problem or something else?

This is the web.config located at /Account/

<?xml version="1.0"?>
<configuration>
  <location path="~/Styles/Site.css">  
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
</configuration>

And this is my websites base web.config:

<?xml version="1.0"?>
<configuration>
  <location path="~/Styles/Site.css">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
<connectionStrings>
    <remove name="halldbConnectionString"/>
    <remove name="ApplicationServices"/>
    <add name="ApplicationServices" connectionString="Data Source=xxx.xxx.xxx.xxx;Initial Catalog=xxxxxx;Persist Security Info=True;User ID=xxx;Password=xxx" providerName="System.Data.SqlClient"/>
    <add name="halldbConnectionString" connectionString="Data Source=xxx.xxx.xxx.xxx;Initial Catalog=xxxxxx;Persist Security Info=True;User ID=xxx;Password=xxx" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
  <compilation debug="true" targetFramework="4.0">
        <assemblies>
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
    <authentication mode="Forms">
   <forms loginUrl="~/Account/Login.aspx" defaultUrl="~/Väljhall.aspx"
timeout="2880" />
  </authentication>
    <membership>
        <providers>
            <clear/>
                    <remove name="AspNetSqlMembershipProvider"/>
            <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="/"/>
        &l开发者_运维技巧t;/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>
</system.web>
<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>


First of all please explore what requests to the css files respond. (Is it 404, 500, 302 response codes). You can do it with any http watcher like HttpAnalyzer.

If css files response contains the information that request was not authorize - try to set AppPool to classic mode


<allow users="*"/> 

changed to

<allow users="?"/> 

did the trick for me

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜