#1
  1. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,706
    Rep Power
    1959

    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. :confused:

    Any one who ever had this issue?
    Last edited by MrFujin; September 14th, 2012 at 09:52 AM.
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,706
    Rep Power
    1959
    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.

IMN logo majestic logo threadwatch logo seochat tools logo