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.
<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?