1

I suddenly get the below error. My application was working fine until I probably modified something, but don't know what

Server Error in '/' Application.
--------------------------------------------------------------------------------

Method is only supported if the user name parameter matches the user name in the current Windows Identity. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Configuration.Provider.ProviderException: Method is only supported if the user name parameter matches the user name in the current Windows Identity.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[ProviderException: Method is only supported if the user name parameter matches the user name in the current Windows Identity.]
   System.Web.Security.WindowsTokenRoleProvider.GetCurrentWindowsIdentityAndCheckName(String userName) +2195661
   System.Web.Security.WindowsTokenRoleProvider.GetCurrentTokenAndCheckName(String userName) +36
   System.Web.Security.WindowsTokenRoleProvider.GetRolesForUser(String username) +61
   System.Web.Security.RolePrincipal.IsInRole(String role) +182
   System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal) +132
   System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb) +256
   System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb) +201
   System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs) +8890701
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

I'm simply trying to access an aspx file in a directory protected by the following

<?xml version="1.0"?>
<configuration>
    <system.web>
        <authorization>
            <deny users="?"/>
        </authorization>
    </system.web>
</configuration>

it works fine without the

<deny users="?"/>

What should I do? I don't think it is normal that my application is referred as '/' . I feel that I have an explicit applicationname in the config file, but maybe it is missing in one section?

Here is my config file :

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  </configSections>
  <appSettings>
    <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
  </appSettings>
  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
      <add listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" type="MyAppConfig.Business.DebugTraceListener, MyAppConfig.Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="DebugTraceListener" formatter="" />
      <add name="Database Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" databaseInstanceName="MyAppConfigLogging" writeLogStoredProcName="WriteLog" addCategoryStoredProcName="AddCategory" formatter="Text Formatter" />
    </listeners>
    <formatters>
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}" name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="General" />
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings" />
    </specialSources>
  </loggingConfiguration>
  <dataConfiguration defaultDatabase="MyAppConfigLogging" />
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </modules>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="ChartImageHandler" />
      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </handlers>
  </system.webServer>
  <connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Application Name=/MyAppConfig;Data Source=.\SQLEXPRESS;Initial Catalog=MyAppConfig;Integrated Security=True"
      providerName="System.Data.SqlClient" />
    <add name="MyAppConfigLogging" connectionString="Application Name=/MyAppConfig;Data Source=.\SQLEXPRESS;Initial Catalog=MyAppConfigLogging;Integrated Security=True"
      providerName="System.Data.SqlClient" />
    <add name="MyAppConfigConnection" connectionString="Application Name=/MyAppConfig;Data Source=.\SQLEXPRESS;Initial Catalog=MyAppConfig;Integrated Security=True"
      providerName="System.Data.SqlClient" />
    <add name="MyAppConfigEntities" connectionString="metadata=res://*/ModelMyAppConfig.csdl|res://*/ModelMyAppConfig.ssdl|res://*/ModelMyAppConfig.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;Initial Catalog=MyAppConfig;Integrated Security=True;MultipleActiveResultSets=True&quot;"
      providerName="System.Data.EntityClient" />
    <add name="MyAppConfigEntities1" connectionString="metadata=res://*/MyAppConfig.csdl|res://*/MyAppConfig.ssdl|res://*/MyAppConfig.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;Initial Catalog=MyAppConfig;Integrated Security=True;MultipleActiveResultSets=True&quot;"
      providerName="System.Data.EntityClient" />
    <add name="MyAppConfigConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyAppConfig;Integrated Security=True;MultipleActiveResultSets=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <!--<authorization>
            <deny users="?"/>
        </authorization>-->
    <httpHandlers>
      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
    </httpHandlers>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </controls>
    </pages>
    <anonymousIdentification enabled="true" />
    <authorization>
      <allow roles="Admin" />
    </authorization>
    <authentication mode="Forms" >
      <forms loginUrl="~/Account/Login.aspx" timeout="2880"  />
    </authentication>
    <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear />
        <add name="SqlProvider"
             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
             connectionStringName="MyAppConfigConnection"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="false"
             applicationName="/MyAppConfig"
             requiresUniqueEmail="true"
             minRequiredPasswordLength="7"
             minRequiredNonalphanumericCharacters="0"
             passwordFormat="Hashed"
             maxInvalidPasswordAttempts="5"
             passwordAttemptWindow="10"
             passwordStrengthRegularExpression="" />
      </providers>
    </membership>
    <profile defaultProvider="SqlProvider">
      <providers>
        <clear/>
        <add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider"
        connectionStringName="MyAppConfigConnection" applicationName="/MyAppConfig" />
      </providers>
      <properties>
        <add name="FriendlyName" />
        <add name="NbOfVisits" allowAnonymous="true" type="System.Int32" />
      </properties>
    </profile>
    <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider" >
      <providers>
        <clear />
        <add connectionStringName="MyAppConfigConnection" applicationName="/MyAppConfig" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
        <add applicationName="/MyAppConfig" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
      </providers>
    </roleManager>
    <httpModules>
      <add name="DomainServiceModule"  type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </httpModules>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true" />
    <client />
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <customBinding>
        <binding name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.ConfiguratorService.customBinding0">
          <binaryMessageEncoding />
          <httpTransport />
        </binding>
        <binding name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.FinanceService.customBinding0">
          <binaryMessageEncoding />
          <httpTransport />
        </binding>
        <binding name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.UserErrorReportService.customBinding0">
          <binaryMessageEncoding />
          <httpTransport />
        </binding>
        <binding name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.StatService.customBinding0">
          <binaryMessageEncoding />
          <httpTransport />
        </binding>
        <binding name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.MyAppConfigAuthenticationService.customBinding0">
          <binaryMessageEncoding />
          <httpTransport />
        </binding>
       <binding name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.DataDisplayService.customBinding0">
          <binaryMessageEncoding />
          <httpTransport />
        </binding>
      </customBinding>
    </bindings>
    <services>
      <service name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.ConfiguratorService">
        <endpoint address="" binding="customBinding" bindingConfiguration="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.ConfiguratorService.customBinding0"
          contract="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.ConfiguratorService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
      <service name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.FinanceService">
        <endpoint address="" binding="customBinding" bindingConfiguration="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.FinanceService.customBinding0"
          contract="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.FinanceService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
      <service name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.UserErrorReportService">
        <endpoint address="" binding="customBinding" bindingConfiguration="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.UserErrorReportService.customBinding0"
          contract="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.UserErrorReportService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
      <service name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.StatService">
        <endpoint address="" binding="customBinding" bindingConfiguration="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.StatService.customBinding0"
          contract="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.StatService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
      <service name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.MyAppConfigAuthenticationService">
        <endpoint address="" binding="customBinding" bindingConfiguration="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.MyAppConfigAuthenticationService.customBinding0"
          contract="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.MyAppConfigAuthenticationService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
      <service name="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.DataDisplayService">
        <endpoint address="" binding="customBinding" bindingConfiguration="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.DataDisplayService.customBinding0"
          contract="MyAppConfig.Silverlight.ConfigEnhanced.Web.Services.DataDisplayService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
      <baseAddressPrefixFilters>
        <add prefix="http://MyAppConfig.com/" />
      </baseAddressPrefixFilters>
    </serviceHostingEnvironment>-->
  </system.serviceModel>
</configuration>
ebcrypto
  • 610
  • 1
  • 14
  • 28
  • You use module , handler `integratedMode`, `validation validateIntegratedModeConfiguration`, `anonymousIdentification`, `authentication Forms`, `membership SqlProvider`, `profile SqlProvider`, and `roleManager` – Kiquenet May 06 '16 at 07:59

1 Answers1

2

You've got a WindowsTokenRoleProvider configured, but it appears that the username is not configured within that roleprovider.

Greg
  • 16,540
  • 9
  • 51
  • 97
  • so should I change the WindowsTokenRoleProvider for something else? I don't really understand how all of this is working (or not) – ebcrypto Feb 01 '11 at 00:20
  • 1
    I have no idea why you have two role providers, especially that one. – Greg Feb 01 '11 at 02:22