0

I have an application page which makes a call to a method in a .NET Assembly. Lets call it "CustomLogger". There is a method "LogData". This method reads connectionstring and calls a stored procedure on SQL database.

Works Fine

<add name="Con1" connectionString="Data Source=dbservername1; Initial Catalog= dbname1; User Id=user1; Password=pwd1;" />

Throws a Permission Denied on Iusr - Works Fine if we wrap the call to CustomLogger.LogData with RunWithElevatedPermissions

<add name="Con1" connectionString="Server=dbservername1;Database=dbname1;Trusted_Connection=True;" />

I don't want to provide permissions to Iusr on my database and want to use trusted connection. Also since this code CustomLogger.LogData is used in both SharePOint projects as well as other .NET projects, I would not want to make sharepoint specific changes to CustomLogger class. Also, within using CustomLogger.LogData across lot of SharePoint projects. 201, 2013 included and It will be tedios for us to wrap CustomLogger.LogData in SharePOint projects with RunWithElevatedPermissions.

Is there any other way to achieve this?

Thanks

0

When you use a trusted connection it uses the app pool account of the Web Application. Make sure that the app pool account has permissions to the database.

1
  • Yes, That appool account has appropriate permission...the issue is, it is hitting sql with IUSR account and not with apppool account. If I wrap the call within RunWithElevatedPermissions, it hits SQL server with Apppool account. Is there a way it can be done without wrapping the call RunWithElevatedPermissions?
    – SPNoob
    Apr 6 '15 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.