The SELECT permission was denied on the object 'Settings', database 'Blogs', schema 'dbo'.

Mar 5, 2013 at 9:48 PM
Hi BEguys,

I am still struggling to fix BLOG issues after we migrated to a new server.

I am receiving this error, but, I do not know what it means.
Can anyone help me out?

I appreciate it.

Server Error in '/' Application.

The SELECT permission was denied on the object 'Settings', database 'Blogs', schema 'dbo'.
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.Data.SqlClient.SqlException: The SELECT permission was denied on the object 'Settings', database 'Blogs', schema 'dbo'.

Source Error:

Line 31:
Line 32: #region Private members
Line 33: private static string _fileName = HostingEnvironment.MapPath(BlogSettings.Instance.StorageLocation + "extensions.xml");
Line 34: private static List<ManagedExtension> _extensions = new List<ManagedExtension>();
Line 35: private static BlogProviderSection _section = (BlogProviderSection)ConfigurationManager.GetSection("BlogEngine/blogProvider");

Source File: c:\inetpub\wwwroot\sdtimes.com\App_Code\ExtensionManager\Manager.cs Line: 33

Coordinator
Mar 5, 2013 at 10:01 PM
In the web.config there is a connection string that specifies server, user and password used to connect to database. Looks like this user can connect to database "Blogs" but do not have permissions to select from "dbo.Settings" table. If you have access to DB server, you can confirm this by logging into SQL server management studio with this user/password and try to run select, should get same error. To fix it, you'd need to login as admin and grant app user read/write permissions on blog tables.
Mar 6, 2013 at 8:25 PM
Edited Mar 6, 2013 at 10:24 PM
Hi rtur,

Thanks. I appreciate your answer. I tried everything but still getting the errors of accessing the BLOG Table(s). It is just a matter of number of tables.
It looks like every blog functions that related to DB is not function well. It happens after we moved to a new server with IIS 7.5.

I did not install BLOG initially and a person who did left the company for a while.
This blog tables initially perform by him with the SQLExpress Database on his local machine.
It seems the blog tables keep asking for the this perticular person's credential but anything else.

I found this comment on SQL forum site.
if it is the case, is there anyway that I can reperform Blog tables?

>>>>>>>>When installing SQL Express permissions are assigned only to the user who performed the installation<<<<<<<<<<<<_

++++++One of the errors that I am getting ++++++++++++++++++++++++++++++++++++=
Cannot open database "Blogs" requested by the login. The login failed.
Login failed for user 'BZMEDIA\JSon'.
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.Data.SqlClient.SqlException: Cannot open database "Blogs" requested by the login. The login failed.
Login failed for user 'BZMEDIA\JSon'.

Source Error:


Line 1098: cmd.CommandText = sqlQuery;
Line 1099: cmd.CommandType = CommandType.Text;
Line 1100: conn.Open();
Line 1101:
Line 1102: using (DbDataReader rdr = cmd.ExecuteReader())


Source File: C:\Users\usuglatwala\Documents\Visual Studio 2008\WebSites\SDTimes3.0\BlogEngine.Core\Providers\DbBlogProvider.cs

++++ END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Coordinator
Mar 6, 2013 at 8:54 PM
BE aside - do you have functional database, the one you can log into from management studio and see tables and data? And what your connection string looks like? It is in web.config, just remove password and server name if it is not local so I can look at it. All those errors useless because they just point the obvious that app can't reach database.
Mar 6, 2013 at 10:22 PM
Yes, I have many other connection string sets and they are working just fine.
I only have problems with "BLOG" tables
------------------Connection String Section--------------------------------------------------------------------------------------------
<!--Start Blog Engine Settings -->
<add name="BlogEngine" connectionString="Data Source=localhost;Initial Catalog=Blogs;Persist Security Info=True;User ID=;Password=;" providerName="System.Data.SqlClient" />
<add name="BlogsConnectionString" connectionString="Data Source=localhost;Initial Catalog=Blogs;Persist Security Info=True;User ID=;Password=;" providerName="System.Data.SqlClient" />

<!--End Blog Engine Settings -->

Please, read this part as well::
After /blog/login.aspx page, I have menu of (Add entry/Controls/Categories/Settings/profiles/Users/Change Password).
Other functions are working but these 3 functions.

When, I clik the links of => Add entry => /blog/admin/pages/Add_entry.aspx.cs ====>foreach (MembershipUser user in Membership.GetAllUsers())
                                         profiles ==>                  ''             /profiles.aspx.cs ======>foreach (MembershipUser user in Membership.GetAllUsers())          
                                         users ===>                   ''             /Users.aspx.cs =======> gridUsers.DataSource = Membershiip.Provider.GetAllUsers(0, 999, out count);

Actual error messages is here:

Server Error in '/' Application.

Data is Null. This method or property cannot be called on Null values.
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.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
Coordinator
Mar 7, 2013 at 3:51 PM
This is confusing, why every time you post different error - something changes or you just do something different? I basically need steps you did to get error(s).
Why there are 2 connections pointing to the same database? Do they use different user or they identical (which would make no sense)?
This new error might be pointing to the issue with membership provider, which is set in the DbMembershipProvider and DbRoleProvider in the same web.config. The fact that you have 2 connections could be because one used for blog provider and probably works fine, I'm guessing you can view blog, and another used for role/membership providers. If that other connection uses different user it could be that this second user does not have correct permissions. Although again it looks like you can get to admin panel, which means you should be able to log in?
Mar 7, 2013 at 6:03 PM
Yes, I am able to login as an Admin and other people can login with their credentials.

I know it is confusing and so am I.
I did not install the BLOG and this is the first time I am seeing and learning about the BlogEngine.

I apologize to you posting different error messages to you because I was confused as well.

Now, I am sure what to tell you about the errors.
This is the the problem that I have.
  1. We do have 2 connection strings pointing the same Database. We do have admin and users, but the users just edit their article through "login" page.
    As an "Admin" I have 7 control links to see:
               1) Add entry 
               2) Controls
               3) Categories
               4) Settings
               5) Profiles
               6) Users
               7) Change Password
    As Users they see 4 control links to see:
               1) Add entry
               2) Categories
               3) Profiles
               4) Change password
    
    1. When I click the links of these 3, I am getting the errors that I posted above.
             1) Add entry  in  /blog/admin/pages/Add_entry.aspx.cs
             2) Profiles            /blog/admin/pages/profiles.aspx.cs
             3) Users               /blog/admin/pages/Users.aspx.cs
    2. When the users click the links of these 2, they are getting the errors that I posted above.
             1) Add entry
             2) Profiles             
      1. The strange thing is as an Admin, I can delete the article, but I cannot add, save, edit.
rtur,
Thank you so much for you time, I truly appreciate it.
I keep working on it based on your tips above.

Thanks again.
Coordinator
Mar 7, 2013 at 7:23 PM
You probably running older BE version, possibly with some code modifications, because I've never seen this issue before. You should see version number in the footer in admin panel, current version is 2.7.0.0 - you probably have something older BlogEngine is a website plus class library which compiled into BlogEngine.Core.dll, not sure if you have full source code or just this compiled DLL. Even if you don't have Core files, you should be able open website in Visual Studio and run it through debugger to check where it actually hit the error and why. If code was modified, there is no way for me to tell what's wrong, for what I know it could use custom membership provider pulling users from Windows active directory... If you really stuck, contact me through my profile here on Codeplex - I'd probably need you to send me your code to understand what is going on.
Mar 12, 2013 at 4:46 PM
Dear rtur,

Thanks for the comments.
Yes, We do have an old version of BE and customized.
I am not sure which version it is, and I guess it is V1.0 maybe?
It looks like BE was installed 2008-2009.

I know now you have a version 2.7, but, it is too complicated for me to upgrading to a newer version at this point.
I am new to BE and our blog is customized, placed and embedded here and their, so, I do not even know which files belong to the original package.
Upgrading will be the future consideration at this time.

I understand that I do not get much help because of the condition of our old BE.
It looks like any functions related to DB is not working well.
Delete is working, so, it is connected I think.
Add, Edit and Save is not working.
If you know a similar case like DB related issues, it might be helpful and appreciated.

I will talk to a System person for your comment about "it could use custom membership provider pulling users from Windows active directory", because I do not know and manage systems.

Thank you so much for your time.
Mar 14, 2013 at 8:14 PM
Edited Mar 14, 2013 at 8:14 PM
Dear rtur,

I think I know what the problem is but still need some help.

I found document of BE site and read section called "Preparation" part below.

This page will show you how to modify BlogEngine.NET to use the default SQL Membership and Role providers that are part of ASP.NET 2.0 Web Site Security. The steps detailed here were validated on a configuration using Windows Vista, Internet Information Services 7 (IIS 7) and SQL Server 2005 Express Edition

Using the command prompt (cmd.exe), run the following command that will create Membership and Role tables in the schema Blog for the server instance SQLExpress that is running on the local machine. 1.aspnet_regsql.exe -s .\SQLExpress -E -A mr -d Blog

I do not have Membership and Role tables.
I try to use the command that BE is showing, but, it does not work.
Now we have Windows 7, SQL Server 20008 R2.

Do you know how to create Membership and Role table, so, I can create similar environment to an intial stage?
I guess, as long as I have those two tables, I may have access to our existing other BE tables.

Thanks,
-taekwon22
Coordinator
Mar 14, 2013 at 9:20 PM
If this is not a new blog and you already have posts/authors - where those authors coming from? It can be that you were using XML for membership and SQL for posts, and then switched all to use SQL. Then you can change membership back to XML provider and be done.
You can even use XML provider for membership regardless, because you DB will also be empty when you generate tables. My concern is that if you have post authors and empty membership this could cause some errors too, so you probably will have to manually create post authors.
Do you have "/setup" folder? This folder should have SQL scripts for specific databases. As far back as I can trace it has SQL Server scripts that include membership tables in it. If you don't, and still need to generate membership tables, for generic questions like this stackoverflow will get you there much faster.
Mar 15, 2013 at 4:28 PM
Edited Mar 15, 2013 at 9:33 PM
Dear rtur,

I use the command provided by BE.net and was able to create blog membership and role tables.
I didn't do it on the server that has all our information reside on Blogs DB.

I performed on my local machine and run sql table script comes from BE V2.7 because I do not have the our original packages.

Now, I have Blog and Blogs DB on my local machine running on SQLExpress.
Of course both DB are empty.

I am wondering what is the next step for Blog DB which has 6 tables:
I know that I have to manually place informations into that tables.
But, I am kind of confused what kind of information to place which tables and columns.
  1. dbo.aspnet_Applications
  2. dbo.aspnet_Membership
  3. dbo.aspnet_Roles
  4. dbo.aspnet_SchemaVersions
  5. dbo.aspnet_Users
  6. dbo.aspnet_UsersInRoles
Thank you so much for the tips.
I am moving on.

-Taekwon22
Mar 19, 2013 at 3:56 PM
Dear rtur,

I used VisualStudio and was able to create Member "Administrator" as "Administrators" Roles.
Then, I create a couple of more users including myself as "Administrator" roles.

Then, I do not know what to do next.

Now, I have 2 DB related to BlogEngine.

"Blog" DB is the one with all aspnet_XXXX tables that I listed above and resides on my local machine created by SQLExpress.
"Blogs" DB is the BlogEngine Db that keeps asking for the permission of the original username and password that I do not have and resides on our remote SQLServer 2012.

I try to recompile through VisualStudio to reset the original username and password.

Our web.config is set to defaultProvider="DbMembershipProvider":
<!--Start Blog Engine Settings-->
<membership defaultProvider="DbMembershipProvider">
  <providers>
    <clear />
    <add name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
    <add name="DbMembershipProvider" type="BlogEngine.Core.Providers.DbMembershipProvider, BlogEngine.Core" tablePrefix="" passwordFormat="Hashed" connectionStringName="BlogEngine"/>
  </providers>
</membership>

<roleManager enabled="true"cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES" defaultProvider="DbRoleProvider">
  <providers>
    <clear />
    <add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
    <add name="DbRoleProvider" type="BlogEngine.Core.Providers.DbRoleProvider, BlogEngine.Core" tablePrefix="" connectionStringName="BlogEngine"/>
  </providers>
</roleManager>

<siteMap defaultProvider="PageSiteMap" enabled="true">
  <providers>
    <add name="PageSiteMap" description="The site map provider that reads in the .sitemap XML files." type="BlogEngine.Core.Web.Controls.PageSiteMap, BlogEngine.Core" />
    <add name="SecuritySiteMap" description="Used for authenticated users." type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" securityTrimmingEnabled="true" siteMapFile="~/blog/Web.sitemap" />
  </providers>
</siteMap>
<!-- End Blog Engine Settings --> Thanks,
-Taekwon22
Coordinator
Mar 19, 2013 at 5:18 PM
This all sounds like BlogEngine from parallel universe :) Your blog could be integrated with existing application and shares membership between both, that would explain 2 database connections. But there are so many ways doing this, I won't even try to guess what's going on without looking at application(s) code.
Mar 21, 2013 at 3:28 AM
rtur,

I found this statement on BlogEngine.NET trobleshooting site.

I can't edit/change settings/etc

This is caused by not having the correct write permissions on the App_Data folder.

This is the problem that I have, but, I do not understand the answer provided here.

I try everything that I can think of.

Network service/aspnet/IIS_IUsers/IUser/Myaccount/Administrator...etc.
I am still not getting the functions of these 3:
   1) Add entry  in  /blog/admin/pages/Add_entry.aspx.cs
   2) Profiles            /blog/admin/pages/profiles.aspx.cs
   3) Users               /blog/admin/pages/Users.aspx.cs

Thanks,
-Taekwon22
Mar 21, 2013 at 8:06 PM
Hi,

---Now I have this error BEGIN----------------------------------------------------

Parser Error Message: Could not load file or assembly 'BlogEngine.Core' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 221: name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
Line 222: <add tablePrefix="" connectionStringName="BlogEngine" name="DbRoleProvider"
Line 223: type="BlogEngine.Core.Providers.DbRoleProvider, BlogEngine.Core" />
Line 224: </providers>
Line 225: </roleManager>
Source File: C:\inetpub\wwwroot\sdtimes.com\web.config Line: 223
------------------------ error END -------------------------------------------------------

What I did is:

I created SqlMembershipProvider and SqlRoleProvider using Web Site Administrator Tool.
I was able to create roles of Administrators and Editors.
Then, I created users with a proper roles related to.

When, I change it to DbMembersipProvider and DbRoleProvider, There are no users.
In the Security Tab of WSA Tools says:
---------------- WSA error BEGIN------------------------------------------------------------------
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission.
It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem:
     Data is Null. This method or property cannot be called on Null values. 
---------------- WSA error END ---------------------------------------------------------------------

this is my Web.config----
<membership defaultProvider="DbMembershipProvider">
  <providers>
    <clear />
    <add connectionStringName="BlogEngine" applicationName="BlogEngine"
      name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" />
    <add tablePrefix="" passwordFormat="Hashed" connectionStringName="BlogEngine"
      name="DbMembershipProvider" type="BlogEngine.Core.Providers.DbMembershipProvider, BlogEngine.Core" />
  </providers>
</membership>
<roleManager enabled="true" cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES"
  defaultProvider="DbRoleProvider">
  <providers>
    <clear />
    <add connectionStringName="BlogEngine" applicationName="BlogEngine"
      name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
    <add tablePrefix="" connectionStringName="BlogEngine" name="DbRoleProvider"
      type="BlogEngine.Core.Providers.DbRoleProvider, BlogEngine.Core" />
  </providers>
</roleManager>

<authentication mode="Forms">
  <forms timeout="129600" name=".AUXBLOGENGINE" protection="All" slidingExpiration="true" loginUrl="~/login.aspx" cookieless="UseCookies"/>
Any idea of this?

Thanks,
-Taekwon22