| |

VerySource

 Forgot password?
 Register
Search
View: 1031|Reply: 1

Access to registry key is denied

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-3-6 14:30:02
| Show all posts |Read mode
"/" Application server error.
-------------------------------------------------- ------------------------------

Access to the registry key HKEY_CURRENT_USER\Software\HFKEY was denied.
Explanation: During the execution of the current web request, an unhandled exception occurred. Please check the stack trace for details about the error and the source of the error in the code.

Exception details: System.UnauthorizedAccessException: Access to the registry key HKEY_CURRENT_USER\Software\HFKEY was denied.

ASP.NET is not authorized to access the requested resource. Please consider granting ASP.NET request ID access to this resource. ASP.NET has a base process ID that is used when the application is not emulated (usually {MACHINE}\ASPNET on IIS 5 and network service on IIS 6). If the application is impersonating via <identity impersonate="true"/>, the identity will be an anonymous user (usually IUSR_MACHINENAME) or an authenticated requesting user.

To grant ASP.NET write access to a file, right-click the file in Explorer, select "Properties", and then select the "Security" tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account and check the box corresponding to the required access permissions.

Source error:


Line 184: //Write a subkey named "Test" under the Software subkey in the HKEY_CURRENT_USER primary key
Line 185: //If the Test subkey already exists, the system will automatically overwrite it
Line 186: regWrite = Registry.CurrentUser.CreateSubKey("Software\\HFKEY");
Line 187: //Add two data items to the Test subkey, one named "HFKEY" and the other named "HFKEY"
Line 188: //


Source file: D:\c# Example\uds\SubModule\Login\Index.aspx.cs Line: 186

Stack trace:


[UnauthorizedAccessException: Access to the registry key HKEY_CURRENT_USER\Software\HFKEY is denied. ]
   Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) +74
   Microsoft.Win32.RegistryKey.CreateSubKey(String subkey) +503
   UDS.SubModule.Login.index.btnSubmit_Click(Object sender, EventArgs e) in D:\c# Example\uds\SubModule\Login\Index.aspx.cs:186
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1292




-------------------------------------------------- ------------------------------

Yesterday, I used it well. I reported an error when I was debugging today. I was dizzy. What is the situation of the master...
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 China

Post time: 2021-3-6 14:45:01
| Show all posts
Run-"regedit->Edit-"Permissions -" add the aSP.NET name
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list