Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...Need help with xp_create_subdir stored proc....HELP!!!!!Need help with xp_create_subdir stored proc....HELP!!!!!
Previous
 
Next
New Post
12/16/2014 12:50 AM
 

I am struggling with getting my SP to update a table, grab the Identity of the new row and then creating a new folder by that name.  I have the SP written and tested...works PERFECTLY...as long as I run it as the SA or other sysadmin account.  I need my DNN users to be able to do so.

This is SQL 2008 and I have researched and try about every combination of  "execute as", proxy users, and even tried making my DNN account an SA equivalent...none of which worked.  I keep getting permission denied.  

Can someone point me to a solution OR an alternative method of creating this folder?

Pulling of hair, grinding of teeth, etc. etc.

 

 
New Post
12/16/2014 9:25 AM
 

Is the database local to DNN or external? Is the error from the SP execution or the folder creation on the file sys?

 
New Post
12/16/2014 9:36 AM
 
erik hinds wrote:

Is the database local to DNN or external? Is the error from the SP execution or the folder creation on the file sys?S

Sites are on the same server as SQL.  

Error is from attempt at the end of the proc:

/* Standard insert code for proc is here...it works fine - 

here is where we have a problem */

SET @RecordID = CONVERT(varchar(10),SCOPE_IDENTITY())

SET @FilePath = 'C:\Site1\Portals\0\Events\'

execute as login = 'domain\username'

/* Read in the folders in the */

INSERT INTO @DirTree(subdirectory, depth)

EXEC master.sys.xp_dirtree @FilePath

IF NOT EXISTS (SELECT 1 FROM @DirTree WHERE subdirectory = @RecordID)

SET @FilePath = 'C:\Site1\Portals\0\Events\' + @RecordID

EXEC master.dbo.xp_create_subdir @FilePath

REVERT

We get the following error from our site call:

Cannot execute as the server principal because the principal "domain\username" does not exist, this type of principal cannot be impersonated, or you do not have permission.

We have confirmed that we have the logins and users properly set up (as best we can tell)....and the proc runs fine when logged in as sysadmin role...we are just trying to get a folder created under Portals/0/events when someone adds a row to a table in the database


 
New Post
12/16/2014 12:51 PM
 

Most likely you are struggling with file system permissions.

I wouldn't create a folder in SQL, this should be done in your code behind.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
12/16/2014 1:04 PM
 
Sebastian Leupold wrote:

Most likely you are struggling with file system permissions.

I wouldn't create a folder in SQL, this should be done in your code behind.

It isn't a file system permission issue (for sure...using local windows admin account, domain admin account, and any other account I thought might work including service acct for SQL).

It has to do with some limitation in SQL 2008 that doesn't permit impersonation of a sysadmin account which is required to run xp_cmdshell....which yes I know is not the most secure process but that is what is available.

I am not writing code for this...been several years since I did any coding (I Buy Spy - DNN 5 days)...it would be a major waste of time for me to try to get back up to speed  and start coding again.  Not going to happen....ever again!

Just looking for a way to create a folder when I add a row to the table... just using a stored proc (limit to my coding!).

Thanks for the response though!

R

 
Previous
 
Next
HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...Need help with xp_create_subdir stored proc....HELP!!!!!Need help with xp_create_subdir stored proc....HELP!!!!!


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out