+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Error viewing custom content block (tutorial): not authorized to 'Create {0}' ('General').

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

8 posts, 1 answered
  1. Doug
    Doug avatar
    6 posts
    Registered:
    16 Jan 2013
    25 Jan 2013
    Link to this post
    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.

    Doug

    Answered
  2. Doug
    Doug avatar
    6 posts
    Registered:
    16 Jan 2013
    29 Jan 2013 in reply to Doug
    Link to this post
    Any suggestions on this issue would be greatly appreciated.  Please let me know if I can provide more information on this.  Thanks again.
  3. Patrick Dunn
    Patrick Dunn avatar
    237 posts
    Registered:
    03 Nov 2014
    30 Jan 2013
    Link to this post
    Hello,

    Thanks for using Sitefinity.
     
    You need to grant access rights to the folder(s) of your ASP.net 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.

    Greetings,
    Patrick Dunn
    the Telerik team
  4. Doug
    Doug avatar
    6 posts
    Registered:
    16 Jan 2013
    30 Jan 2013 in reply to Patrick Dunn
    Link to this post
    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. 

    Cheers,
    Doug
  5. Doug
    Doug avatar
    6 posts
    Registered:
    16 Jan 2013
    30 Jan 2013 in reply to Patrick Dunn
    Link to this post
    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.  
  6. Doug
    Doug avatar
    6 posts
    Registered:
    16 Jan 2013
    31 Jan 2013 in reply to Doug
    Link to this post
    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. 
  7. Patrick Dunn
    Patrick Dunn avatar
    237 posts
    Registered:
    03 Nov 2014
    01 Feb 2013
    Link to this post
    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.

    Greetings,
    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
  8. Doug
    Doug avatar
    6 posts
    Registered:
    16 Jan 2013
    01 Feb 2013 in reply to Patrick Dunn
    Link to this post
    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.).
8 posts, 1 answered