Multiple web.config files works locally but not after uploading to web site

Last post 05-19-2008 11:07 AM by TGirgenti. 10 replies.

Sort Posts:

  • Multiple web.config files works locally but not after uploading to web site

    05-12-2008, 6:50 PM
    • Loading...
    • TGirgenti
    • Joined on 03-01-2006, 5:32 PM
    • Posts 109

    Hello.

    VS2005 Pro, SP1, ASP.Net 2.0, .Net 2.0, Ajax 1.0.61025, WSE 3.0 web consuming client.

    I can't figure out why my roles/rules are not working after uploading latest changes to discountAsp.net

    I have certain pages that are restricted to role "Administrators". When i test it locally it works fine, but after uploading it to discountASP.net, it does not work the same way.  It just goes back to the deafult.aspx page.

    I have one page that will not display certain buttons except for role "Administrators" only and that works fine. It does show the button when i am logged on with "Administrators" role.

    The web pages that are not displaying for "Administrators" role has it's own web.config in the folder.

    Is there something special i need to do for folders that have their own web.config?

    Any help that anyone can provide would be gratefully appreciated.

    Thanks,
    Tony

    Here is my root web.config:

    <?xml version="1.0"?><!--
        Note: As an alternative to hand editing this file you can use the
        web admin tool to configure settings for your application. Use
        the Website->Asp.Net Configuration option in Visual Studio.
        A full list of settings and comments can be found in
        machine.config.comments usually located in
        \Windows\Microsoft.Net\Framework\v2.x\Config
    -->
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
     <configSections>
      <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
         <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
         <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
         <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
       </sectionGroup>
      </sectionGroup>
     </configSections>
     
      <connectionStrings>
      <add name="CoyneWebDatabaseConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\CoyneWebDatabase.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
     </connectionStrings>
     
      <system.web>
      <roleManager enabled="true" defaultProvider="CustomizedRoleProvider">
       <providers>
        <add name="CustomizedRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="CoyneWebDatabaseConnectionString"/>
       </providers>
      </roleManager>
      <membership defaultProvider="CustomizedMembershipProvider">
       <providers>
        <!--        <add name="CustomizedMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="CoyneWebDatabaseConnectionString" applicationName="/WebServices"/> -->
        <clear/>
        <add name="CustomizedMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="CoyneWebDatabaseConnectionString" applicationName="/CoyneWebServices"/>
       </providers>
      </membership>
      <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
       <providers>
        <add name="XmlSiteMapProvider" description="Default SiteMap provider." type="System.Web.XmlSiteMapProvider " siteMapFile="Web.sitemap" securityTrimmingEnabled="true"/>
       </providers>
      </siteMap>
      <compilation debug="true">
       <assemblies>
        <add assembly="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
          </assemblies>
       <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       </buildProviders>
      </compilation>
      <authentication mode="Forms">
       <forms slidingExpiration="true" timeout="60" loginUrl="default.aspx" defaultUrl="default.aspx"/>
      </authentication>
        <authorization>
          <allow roles="Administrators" />
          <deny users="*" />
        </authorization>

        <!-- Use any of the following values for the styleSheetTheme attribute: "Granite", "Sand", "Paper".-->
      <pages styleSheetTheme="Granite">
       <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       </controls>
       <namespaces>
        <add namespace="System.Data"/>
        <add namespace="System.IO"/>
       </namespaces>
      </pages>
      <httpHandlers>
       <remove path="*.asmx" verb="*"/>
       <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
       <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
       <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
       <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
        </httpHandlers>
      <httpModules>
       <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </httpModules>
      <webServices>
       <soapExtensionImporterTypes>
        <add type="Microsoft.Web.Services3.Description.WseExtensionImporter, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       </soapExtensionImporterTypes>
       <soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </webServices>
     </system.web>
     
      <microsoft.web.services3>
      <policy fileName="wse3policyCache.config"/>
     </microsoft.web.services3>
     
      <system.webServer>
      <validation validateIntegratedModeConfiguration="false"/>
      <modules>
       <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </modules>
      <handlers>
       <remove name="WebServiceHandlerFactory-Integrated"/>
       <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </handlers>
     </system.webServer>
     
      <location allowOverride="true" inheritInChildApplications="true">
        <appSettings>
          <add key="CompanyName" value="George S. Coyne Chemical Co., Inc." />
          <add key="CompanySlogan" value="Start With Quality, Finish With Coyne" />
          <add key="CompanyAddress" value="3015 State Road, Croydon, PA  19021" />
          <add key="CompanyCopyright" value="Copyright 2007 George S. Coyne Chemical Co., Inc. All Rights Reserved." />
          <add key="CompanyURL" value="http://localhost:39733/" />
          <add key="CompanyMailServer" value="mail.club.com" />
          <add key="CompanyMailUsername" value="admin@club.com" />
          <add key="CompanyMailPassword" value="password" />
          <add key="ReportContentUpdate" value="false" />
          <add key="XatanetCompanyName" value="Coyne Chemical" />
          <add key="XatanetUserName" value="xatadl" />
          <add key="XatanetPassword" value="download" />
          <add key="WebMaster" value="webmaster@clubsite.com" />
          <add key="TripExportService.TripExportService" value="http://xatanet.net/xatanetwebservice/TripExportService.asmx" />
        </appSettings>
      </location>
     
    </configuration>

    Here is a web.config from one of the folders that is not allowing role "Administrators":

    <?xml version="1.0" encoding="utf-8"?>
    <
    configuration>
    <
    location path="Default.aspx">
    <
    system.web>
    <
    authorization>
    <
    allow roles="Administrators" />
    <
    deny users="*" />
    </
    authorization>
    </
    system.web>
    </
    location>
    </
    configuration>

  • Re: Multiple web.config files works locally but not after uploading to web site

    05-14-2008, 4:39 AM

    TGirgenti:

    Here is a web.config from one of the folders that is not allowing role "Administrators":

    <?xml version="1.0" encoding="utf-8"?>
    <
    configuration>
    <
    location path="Default.aspx">
    <
    system.web>
    <
    authorization>
    <
    allow roles="Administrators" />
    <
    deny users="*" />
    </
    authorization>
    </
    system.web>
    </
    location>
    </
    configuration>

    Hi

    I wonder why you need to specify location path="Default.aspx" in the sub folder's web.config file? Is there any distinction in this line?

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Multiple web.config files works locally but not after uploading to web site

    05-14-2008, 5:19 AM
    • Loading...
    • TGirgenti
    • Joined on 03-01-2006, 5:32 PM
    • Posts 109

    Hello XiaoYong.

    I'm not sure about that.  I just copied it from a security tutorial.

    I removed it and it still does not work.

    Thanks,
    Tony

  • Re: Multiple web.config files works locally but not after uploading to web site

    05-14-2008, 6:14 AM

    Well, can you verify the following code and write back your result?

    ------------sub folder web.config-----------

    <?xml version="1.0" encoding="utf-8"?>
    <
    configuration>

    <
    system.web>
    <
    authorization>

    <
    deny users="*" />
    </
    authorization>
    </
    system.web>
    </
    location>
    </
    configuration>

    -----------------test.aspx---------

    protected void Page_Load(object sender, EventArgs e)

    {

             if (User.IsInRole("Administrators"))
            {

                Response.Write("Logged in as Administrators");
            }
            else {
                Response.Write("Redirect to default.aspx");
            }

    }

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Multiple web.config files works locally but not after uploading to web site

    05-14-2008, 4:07 PM
    • Loading...
    • TGirgenti
    • Joined on 03-01-2006, 5:32 PM
    • Posts 109

    Hello XiaoYong.

    I appreciate you working with me this way.

    Assuming you meant to take out the </location> line in your example of the sub folder web.config and changing your C# code to:

     

    If User.IsInRole("Administrators") Then
           Response.Write("Logged in as Administrators")
    Else
           Response.Write("Redirect to default.aspx")
    End If

    I uploaded the changed files to the live web site and tried your test.  Without logging in, nothing happened.  After logging in with the user that has role "Administrators", it still did nothing.  I saw nothing write to the screen in both cases.

    Also, in testing with your configuration locally, it worked ok on everything except for the sub folder where i made your changes.  For that folder, it just did nothing.

    Thanks for all of your help in trying to help resolve this problem.

    Tony

  • Re: Multiple web.config files works locally but not after uploading to web site

    05-14-2008, 11:46 PM

    Hi

    My fault, what about use

    ------------sub folder web.config-----------

    <?xml version="1.0" encoding="utf-8"?>
    <
    configuration>

    <
    system.web>
    <
    authorization>

    <
    allow users="*" />
    </
    authorization>
    </
    system.web>
    </
    location>
    </
    configuration>

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Multiple web.config files works locally but not after uploading to web site

    05-15-2008, 8:20 AM
    • Loading...
    • TGirgenti
    • Joined on 03-01-2006, 5:32 PM
    • Posts 109

    Yes.  That is what i used without the </location> line.

    Thanks,
    Tony

  • Re: Multiple web.config files works locally but not after uploading to web site

    05-15-2008, 10:55 PM

    But it's going to be entirely different than what I test with my local machine. Well, could you paste your current web.config in sub folder?

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Multiple web.config files works locally but not after uploading to web site

    05-16-2008, 9:51 AM
    • Loading...
    • TGirgenti
    • Joined on 03-01-2006, 5:32 PM
    • Posts 109

    Hello XiaoYong.

    If i understand you correctly, you want the cuurent web.config from my sub-folder on my live web site.  Here it is:

     <?xml version="1.0" encoding="utf-8"?>
    <
    configuration>
        <system.web>
            <
    authorization>
                <deny users="*" />
            </
    authorization>
        </
    system.web>
    </configuration>

    Also, is there some way that you can respond to my answers more often than once per day.  I would like to resolve this problem in a more timely manner and at the current rate it might take weeks for us to accomplish this.  At the risk of sounding unappreciative, it would be nice if we could move a little faster.

    Thanks,
    Tony

  • Re: Multiple web.config files works locally but not after uploading to web site

    05-18-2008, 10:37 PM

    TGirgenti:
      <deny users="*" />

     

    Hi

    Can you refine the code use "allow users="*" " as said in my preview post? I think we work in a different time-zone and it's not easy to respond in time, For urgent issues, I would suggest posting in the forum below:
    http://support.microsoft.com/common/international.aspx?rdpath=fh;en-us;cntactms
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, with direct assistance from a Microsoft Support Engineer through Microsoft Customer Support Services. You can contact Microsoft Product Support directly to discuss additional support options you may have available, by contacting us at 1-(800)936-5800 or by choosing one of the options listed at the previous linkThank you for your understanding.

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Multiple web.config files works locally but not after uploading to web site

    05-19-2008, 11:07 AM
    Answer
    • Loading...
    • TGirgenti
    • Joined on 03-01-2006, 5:32 PM
    • Posts 109

    Hello XiaoYong.

    Thanks for all of the help that you have provided.

    I resolved my problem by adding this  applicationName="/CoyneWebServices" to the end of the CustomizedRoleProvider as indicated below.

      <roleManager enabled="true" defaultProvider="CustomizedRoleProvider">
          <providers>
              <add name="CustomizedRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="CoyneWebDatabaseConnectionString" applicationName="/CoyneWebServices"/>
          </providers>
      </roleManager>

    Thanks again for staying with the problem until i found a solution.

    Tony