0

I upload my project to IIS ,I used my custome sqlmembership provider.and createed roles and users ,but when I tring to edit/delete/update data ,It tell me "u dont have a permission to do that" but inside the roles already define it can do that. Plus I am using VS ASP.NET configuration tool,to add user and roles but when click the test button onAspNetSqlRoleProvider ,it tell me not found database.It works fine with VS build-in server but I upload the IIs ,it give error.

here is the a part of web.config

<system.web>
    <roleManager enabled="true" />
    <customErrors mode="RemoteOnly" defaultRedirect="~/Admin/Hata.aspx" />
    <authentication mode="Forms">
      <forms cookieless="AutoDetect" loginUrl="~/Login.aspx" />
    </authentication>
    <membership defaultProvider="MySqlMembershipProvider">
      <providers>
        <clear/>
        <!--Add a customized SqlMembershipProvider -->
        <add name="MySqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider"
             connectionStringName="OSProjeConnectionString" enablePasswordRetrieval="false"
             enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" 
             passwordFormat="Hashed" maxInvalidPasswordAttempts="15" minRequiredPasswordLength="5" 
             minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             passwordStrengthRegularExpression="">
      </providers>
    </membership>

    <connectionStrings>

        <add name="OSProjeConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=OSProje;Integrated Security=SSPI; User ID=sa;Password=password;" />
      </connectionStrings>

.............. ...................

edıt : I fix the problem adding this lines

<roleManager defaultProvider="roleProvider">         
    <providers>
        <add connectionStringName="OSProjeConnectionString" 
             name="roleProvider"
             type="System.Web.Security.SqlRoleProvider" />
    </providers>
</roleManager>
Peter
  • 13,733
  • 11
  • 75
  • 122
sakir
  • 3,391
  • 8
  • 34
  • 50
  • Can you show the "OSProjeConnectionString"? – PM. Aug 21 '13 at 06:06
  • YES I added the connection string – sakir Aug 21 '13 at 06:13
  • Change the Integrated Security=false, in that way it will take the username and password provided in the connection string. – PM. Aug 21 '13 at 06:19
  • For more details refer [this](http://stackoverflow.com/questions/1229691/difference-between-integrated-security-true-and-integrated-security-sspi) – PM. Aug 21 '13 at 06:21
  • I changeed but still tell me coulnt find the AspNetSqlRoleProvider – sakir Aug 21 '13 at 06:29
  • still tell me "coulnt establish the connection to database" – sakir Aug 21 '13 at 06:33
  • Try once to connect to the database server of machine using the credentials passing in ConnectionString. Use SSMS to connect to the database. – PM. Aug 21 '13 at 06:36
  • inside the IIs there is anaother connection string called LocalSqlServer is this normal,when I change the integrated securiti to false give me error.problem still same change nothing – sakir Aug 21 '13 at 06:47
  • plus there is an App_Data folder inside my web pages ,I even didit created this.how it comes up? – sakir Aug 21 '13 at 06:49

1 Answers1

1

Here is the line which is creating problem. But you have not specified the DefaultProvider, so it takes AspNetSqlRoleProvider as the provider. Now you have to check the settings of AspNetSqlRoleProvider. Or you can add the following code:

<roleManager 
enabled="false" 
cacheRolesInCookie="false" 
cookieName=".ASPXROLES" 
cookieTimeout="30" 
cookiePath="/" 
cookieRequireSSL="false" 
cookieSlidingExpiration="true" 
cookieProtection="All" 
defaultProvider="AspNetSqlRoleProvider" 
createPersistentCookie="false" 
maxCachedResults="25">
<providers>
  <clear />
  <add 
     connectionStringName="LocalSqlServer" 
     applicationName="/" 
     name="AspNetSqlRoleProvider" 
     type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  <add 
     applicationName="/" 
     name="AspNetWindowsTokenRoleProvider" 
     type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0,        
     Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 </providers>
</roleManager>

With some modifications.

Regarding App_Data folder, its automatically created for the application related data. For more details read this

Community
  • 1
  • 1
PM.
  • 1,735
  • 1
  • 30
  • 38