Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

#1
September 14th, 2012, 08:42 AM
 MrFujin
Lord of the Dance

Join Date: Oct 2003
Posts: 3,129
Time spent in forums: 2 Months 2 Weeks 22 h 45 m 15 sec
Reputation Power: 1736
C# & IIS 7 - issue reading correct registry key when using impersonate

Hi,

I posted here, but don't know if the issue is related to IIS7 or my code.

I have created a IIS7 SOAP Web application which does not read the correct values from the registry. I read the registry using following code:
Code:
key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\path\\to\\key");
string tempPath = (string)key.GetValue("tempPath");

The path is used to read the output from a PDF printer.

The application is configured with impersonate as a specific user with local administrator rights, e.g. domain_user1.

When I call the service from my client PC, the service want to use the system temp folder: C:\Windows\temp, instead of the value from registry (D:\temp)

if I log in with domain_user1 to the system using remote desktop, then it does give the correct value.

For my web application I have also
- enabled anonymous access using IUSR.
- set Domain_user1 in connec to.
- created a new application pool with Domain_user1 as identity.
- with with load user folder for the application pool.

It looks like it is reading %temp% from somewhere.

The reason I changed the path away from the standard temp folder is that the service and/or the printer have issues with accessing it, even if "everyone" has full permission.

Could not find any solution on Google, most of what i found told that adding a impersonate will be the solution.

Any one who ever had this issue?

Last edited by MrFujin : September 14th, 2012 at 08:52 AM.

#2
September 14th, 2012, 05:33 PM
 MrFujin
Lord of the Dance

Join Date: Oct 2003
Posts: 3,129
Time spent in forums: 2 Months 2 Weeks 22 h 45 m 15 sec
Reputation Power: 1736
I decided to have the information into the configuration file too, but am still interested in any comments that can explain why I got this behaviour/issue.

Currently, I now try to call the excel printEx function where it return with "no printers are installed", even though I can go through PrinterSettings, find the correct printer and set it as default printer.

 Viewing: Dev Shed Forums > Programming Languages > C Programming > IIS 7 - issue reading correct registry key when using impersonate