-2

I need your help because my asp.net App is working on Local but on server it's create this error:

Access to the registry key 'HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0' is denied.

Code:

WebForm1.pathCollection.TryGetValue(Form.releaseList.SelectedItem.ToString(), out value);

TfsUtils.CheckChangeExist(value + "\\" + Form.envList.SelectedItem.ToString());
File.SetAttributes(value + "\\" + Form.envList.SelectedItem.ToString(), FileAttributes.Normal);
File.WriteAllText(value + "\\" + Form.envList.SelectedItem.ToString(), WebForm1.tmpSave);
WebForm1.SessionVar.Ws.PendEdit(value + "\\" + Form.envList.SelectedItem.ToString());

This code is inside a try-Catch and it stop working before the line PendEdit();

Do you have any suggestions ?

Edit: My problem could be similar to this topic.

Does TFS API require Visual Studio?

Nicolas Roche
  • 105
  • 1
  • 1
  • 14
  • 1
    Have you considered that you don't have access to the registry? – Liam Apr 24 '18 at 13:33
  • 2
    BTW letting a web page access the servers registry is a really (and I can't emphasis this enough) **REALLY** bad idea. Say I managed to inject some code into your web page. What would stop me bricking your server? – Liam Apr 24 '18 at 13:33
  • I think it would be more to do with the account privileges the app is running under. – Steve Apr 24 '18 at 13:34
  • Possible duplicate of [How to get registry write permissions in C#](https://stackoverflow.com/questions/721145/how-to-get-registry-write-permissions-in-c-sharp) – Liam Apr 24 '18 at 13:37
  • ...honestly don't do this....walk away now, you still have time... – Liam Apr 24 '18 at 13:37
  • @Liam I don't think there's any writing to the registry going on -- it looks as though he's using some iteration of the TFS API to change some files in source control. The API is trying to find the location of the correct utilities to invoke to make the change by querying the registry. I'd question a lot of these choices, but I don't think he's trying to manipulate the registry directly in his code. – Daniel Mann Apr 24 '18 at 13:45
  • I'm not using registry, as Daniel i'm only working with TFS API. On some other part of my program the use of tfs api fully working on server. – Nicolas Roche Apr 24 '18 at 14:04

1 Answers1

1

The solution was:

  • Go Application Pools of IIS, select the website where my app is hosted.
  • set "Load User Profile"=True.
  • Restart the Website
Nicolas Roche
  • 105
  • 1
  • 1
  • 14