Error viewing custom content block (tutorial): not authorize

Posted by Community Admin on 04-Aug-2018 19:21

Error viewing custom content block (tutorial): not authorized to 'Create {0}' ('General').

All Replies

Posted by Community Admin on 25-Jan-2013 00:00

Hi - I'm working through the Developer Training tutorial videos, and I'm running into an error in "Working With Content Blocks".  I'm trying to create a custom content block programatically via VS2012 for a simple SQLServer-based project I've created.  The project otherwise works and builds fine, and runs from both VS2012 and the SF Dashboard.  Once I defined the new content block object as per the tutorial in VS2012 (via standard ContentManager/ContentItem code, not the Fluent version), I select View in Browser, and I then get this error: 

You are not authorized to 'Create 0' ('General').

... and it highlights this line as erroneous in the aspx.cs code for the content block:

ContentItem item = manager.CreateContent();

... and this additional info: 

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically MACHINE\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

I'm not sure how to interpret this or what else to do - I modified the Properties/Security for the project folder to allow full ANONYMOUS LOGON rights, along with NETWORK SERVICE too.  I am logged in as the machine Admin. 

Thanks for any help you can offer.


Posted by Community Admin on 29-Jan-2013 00:00

Any suggestions on this issue would be greatly appreciated.  Please let me know if I can provide more information on this.  Thanks again.

Posted by Community Admin on 30-Jan-2013 00:00


Thanks for using Sitefinity.
You need to grant access rights to the folder(s) of your application. It all depends on what your goals with regards to security are. Normally, you would allow access to ASPNET or NETWORK SERVICE (for .NET Server).

Please take a look at this article about the subject.

Patrick Dunn
the Telerik team

Posted by Community Admin on 30-Jan-2013 00:00

Thanks, Patrick.  I will read the article you referenced now.  I thought I had the permissions set correctly, but obviously I don't.  Since it's on my local machine, I don't need to get fancy with security in this case. 


Posted by Community Admin on 30-Jan-2013 00:00

After reading the article linked above and looking my folder permissions, I am still unable to create a custom content block via the ContentManager-based API calls in C#.  I am working with a local trial version of Sitefinity.  I create a project using the Sitefinity Project Manager, SQL2008 backend, and this all works fine.  I create the subfolder in the project (CustomContentBlocks) and then the associated Web Form that contains the C# code to create the content block.  When I View In Browser for the .aspx file, I continue to get the error message described in the OP above.  I am logged in as the machine admin - full rights, this is my dev machine.  This app is running localhost.  SQL Server is running local as well.

Discouraging - many of the tutorials that we paid money for require this kind of integration with the C# side of things, and this isn't working.  

Posted by Community Admin on 31-Jan-2013 00:00

I found a workaround, but I'm not sure it solves the underlying issue.

On my local machine - I use the SF Project Manager to create a new project.  Before I start the new site and configure the DB and all that, I go into VS2012 and programmatically create the new custom content block in an aspx page (with the associated C# code).  I then tell VS to View in Browser for the new page, which then first kicks off the project configuration process over in the browser.  When that's completed, I then tell VS to View in Browser my new custom content block page, and then it works fine and adds it to SF.  No problem. 

But, if I reverse things so that I create the new project, and then immediately configure the project's DB and other stuff, and THEN add the new custom content block to the VS project and View in Browser, I get the permissions error I described above. 

After all of this, if I close the new project website, and close VS, and close the SF Project Manager, and then re-open everything, and then try to create a new custom content block programmatically, it again fails with the error in the OP. 

Posted by Community Admin on 01-Feb-2013 00:00

Hello Doug,

 I'm not able to reproduce this locally. How are you configuring your database? Are you using SQL Express and Windows authentication or are you doing something else? To try to see what's going on can you create a project in your documents and configure it using SQL Express (the MDF file)? Let's see if that throws any problems because the error given is a generic ASP.NET error message related to permissions for any ASP.NET app.

Patrick Dunn
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 01-Feb-2013 00:00

Hi Patrick - thanks again for the info.  I don't think it's a SQL Server or SQLExpress issue - I can do most everything else in the Sitefinity backend that end up interacting with the DB without any issues.  I'm using SQLServer that's running on my local machine, Windows authentication.  That part seems to look fine. 

Here's what I have found in the interim to work every time:  if I avoid initiating either VS2012 or the Sitefinity app from the SF Project Manager, my problems go away. 

I start up VS by going into the directory where the project is, and then I click on SitefinityWebApp.sln, which brings up VS.  I then run the project (without debug) from VS - the SF website comes up in a browser, and then I add /Sitefinity onto the URL to login to the backend.  Once logged in, I go back to VS, run View in Browser on the .aspx page for the custom content block, and it succeeds.  Every time. 

It seems that there is something going on with the SF Project Manager, VS, and the SF backend that creates a situation where there might be multiple "users" trying to access the project, or different Cassini port #'s, or whatever.  In any case, removing the SF Project Manager from the equation let's me work with the externally-defined custom content blocks, and I'd assume, any of the other custom elements (News, Blogs, Events, etc.).

This thread is closed