Roles not working after upload

Discussion in 'ASP.NET 2.0' started by Tonyg, May 11, 2008.

  1. Hello.

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

    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.

    I have one page that displays buttons for "Administrator" only and that works. It does show the button when i am logged on with "Administrator" role.

    The web pages that are not displaying for "Administrator" 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 thatanyone can provide would be gratefully appreciated.

    Thanks,
    Tony
     
  2. Hello Dipset.


    I have attached my web.config. Thanks for your help.


    Tony
    <!--
    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>
    <!-- For live to discountASP.Net
    <add name="pubsConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\pubs.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
    <add name="CoyneWebDatabaseConnectionString" connectionString="Data Source=tcp:sql2k509.discountasp.net;Initial Catalog=SQL2005_392200_coynedb;User ID=SQL2005_392200_coynedb_user;Password=xxxxxxxx"/>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k509.discountasp.net;Initial Catalog=SQL2005_392200_coynedb;User ID=SQL2005_392200_coynedb_user;Password=xxxxxxxx"/>
    -->
    <add name="CoyneWebDatabaseConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\CoyneWebDatabase.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
    <!-- For local
    <add name="CoyneWebDatabaseConnectionString" connectionString="Data Source=tcp:sql2k509.discountasp.net;Initial Catalog=SQL2005_392200_coynedb;User ID=SQL2005_392200_coynedb_user;Password=xxxxxxxx"/>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k509.discountasp.net;Initial Catalog=SQL2005_392200_coynedb;User ID=SQL2005_392200_coynedb_user;Password=xxxxxxxx"/>
    <add name="CoyneWebDatabaseConnectionString" connectionString="server=mssql02.1and1.com;initial catalog=db212204016; uid=dbo212204016; Pwd=hBzEj5Ap"/>
    <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"/>
    <add assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.ReportSource, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.Enterprise.Framework, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.Enterprise.Desktop.Report, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/><add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></assemblies>

    <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>
    <!-- Use any of the following values for the styleSheetTheme attribute: "Granite", "Sand", "Paper".-->
    <pages styleSheetTheme="Granite" theme="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"/>
    <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></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="[email protected]" />
    <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="[email protected]" />
    <add key="TripExportService.TripExportService" value="http://xatanet.net/xatanetwebservice/TripExportService.asmx" />
    <add key="CrystalImageCleaner-AutoStart" value="true" />
    <add key="CrystalImageCleaner-Sleep" value="60000" />
    <add key="CrystalImageCleaner-Age" value="120000" />
    </appSettings>
    </location>
    </configuration>


    Post Edited (Tony Girgenti) : 5/11/2008 6:11:38 PM GMT
     
  3. Just in case,if the pages that are not working as expected are under a separate web application,you have to add the Role 'Administrators' (ApplicationID in the aspnet_Roles Table) for that application as well.This may be causing the issue.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  4. Hello Vikram.


    What is a seperate web application?


    As far as i know, this is one web site application.


    Thanks,
    Tony
     
  5. Does anybody understand what Vikram is telling me? I don't know what he means by "seperate web application".


    Any help that anybody can provide for this question or my original problem would be gratefully appreciated.


    Thanks,
    Tony
     
  6. From what I can see your web.config is using an express DB.
    You appear to have been running thisas alocal application but it now fails remotely.
    If this is the case my guess is you may be confused about using the Express DB on the remote site.
    Please take a look at this, it's an on-going project to help with this sort of thing:
    http://iis7testcom.web701.discountasp.net/membershipprovider/
    Salute,
    Mark
     
  7. Hello Mark.


    I'm not sure of what you are saying.


    The web site has been running for months with the same web.config. I made changes to secure certain pages based on roles. If the database is wrong, why would it do everything else correctly for all these months?


    I have the database setup exactly the way discount.Asp.net said to do it from articles in their knowledgebase.


    Thanks,
    Tony
     
  8. Bruce

    Bruce DiscountASP.NET Staff

    Web application means the application root for IIS. YOu can many of these.

    Did you configure any of your sub directory to be an application using the control panel's web application tool?

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  9. Hello Bruce.


    No, I did not configure any sub directories to be an application.


    Does that mean what Vikram is suggesting does not apply to me?


    Thanks,
    Tony
     
  10. Hello Mark.


    So with that issue out of the way, i guess you don't have any idea of why this is not working for me.


    Thanks,
    Tony
     
  11. What I was referring to earlier was that if you see in the 'aspnet_Applications' table in your membership database,you notice Application names with corresponding application id's,which you will also find in the 'aspnet_Roles' table.

    Now, since you had mentioned 'the web pages that are not displaying for 'Administrator' role has it's own web.config in the folder',it is possible that you may have to add the Administrator role for these applications/folders (which are assumed were applications themselves (separate applications)) as well, for the pages within these applications/folders to work as expected.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  12. Hello Vikram.


    Here is the data from the tables aspnet_Roles and aspnet_Applications respectively. Only one record in each table.
    3ffe7c78-3c2f-45b0-94ca-d66ab3fda4834db93a9a-5f79-4cab-8162-3ebbeb43ce57AdministratorsadministratorsNULL


    /CoyneWebServices/coynewebservices3ffe7c78-3c2f-45b0-94ca-d66ab3fda483NULL



    Are you saying that i should add a record to the aspnet_Applications table so that the table would look like:
    /CoyneWebServices/coynewebservices3ffe7c78-3c2f-45b0-94ca-d66ab3fda483NULL
    /CoyneWebServices/FileMaintenance/coynewebservices/filemaintenance3ffe7c78-3c2f-45b0-94ca-d66ab3fda483NULL


    Thanks,
    Tony
     
  13. Mark.


    I figured out why it looks like i'm using an SQLExpress Database. I posted my web.config for local testing. If you look above that connectstring line, you'll see that i have commented out the live connection string. This is what i use for live hosting:


    <add name="CoyneWebDatabaseConnectionString" connectionString="Data Source=tcp:sql2k509.discountasp.net;Initial Catalog=SQL2005_392200_coynedb;User ID=SQL2005_392200_coynedb_user;Password=xxxxxxxx"/>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k509.discountasp.net;Initial Catalog=SQL2005_392200_coynedb;User ID=SQL2005_392200_coynedb_user;Password=xxxxxxxx"/>

    Thanks,
    Tony
     
  14. Yeah I noticed that just now.
    I have been helping so many Express DB users my eyes get crossed. [​IMG]
    Salute,
    Mark
     
  15. Does anybody at all have any idea at all as to why this problem is occurring?

    Does anybody know what Vikram's last reply means? Did i intrepret his reply correctly and give him the correct data?

    I tried posting requests here, Google, ASP.NET, searching the internet and reading numerous articles and tutorials about roles and user logins. None of that has provided an answer to my problem.

    This forum seems to be the most logical, practical and sensible place to get an answer to my problem especially since it is the recommended route by discountAsp.net tech support and it is monitored by discountAsp.net users and moderators.

    However, i have been trying for days to get help with this problem and at the risk of sounding unappreciative, the repliers appear to be forum moderators and it either takes them days to reply or they don't answer the questions asked. If they don't know how to troubleshoot this type of problem, it would be appreciated if they would just say that instead of just not replying.

    My other option would be to go to a hoster that provides technical support, but i am trying to avoid that because i know it will take me numerous hours of setup, moving files and more configuration. With the way things are going here, that might the most cost effective option.

    I know this post will probably make my chances worse of getting any help with this problem, but it bothers the heck out of me and it is very frustrating.
     
  16. Try also setting the same applicationName property to the roleManager provider.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  17. Hello Aristotle.


    Thanks very much for that. That fixed the problem. Here is how i did it:


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


    Tony
     

Share This Page