Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8055383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:22:10+00:00 2026-06-05T08:22:10+00:00

I am trying to create an registry, but it give me following message. Access

  • 0

I am trying to create an registry, but it give me following message.

Access to the registry key ‘HKEY_LOCAL_MACHINE\Software\aspire’ is denied

And following is my code.

protected void CreateRegistry()
    {
        dtStartDate = DateTime.Now;

        string strUser = Environment.UserDomainName + "\\" + Environment.UserName;

        RegistrySecurity rs = new RegistrySecurity();
        //rs.AddAccessRule(new RegistryAccessRule("Administrator", RegistryRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow));
        rs.AddAccessRule(new RegistryAccessRule(strUser, RegistryRights.FullControl, InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow));

        RegistryKey regDate = null;

        try
        {
            regDate = Registry.LocalMachine.CreateSubKey("Software\\aspire", RegistryKeyPermissionCheck.Default, rs);

            if (regDate != null)
            {
                regDate.SetValue("Date", dtStartDate.ToString(strDateFormat));
                regDate.Close();
                MessageBox.Show("created");
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message.ToString());
        }

    }

when i am executing the same code in different system, the code runs correctly.
b’coz there isn’t created any user on that system.
But now in this system i have created 2 user from control panel, and this is happening with me.
Both Systems are running on Windows 7.

PLease help

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:22:12+00:00Added an answer on June 5, 2026 at 8:22 am

    If you are using windows 7, start run the application in administrator mode. if you are debugging from visual studio, start visual studio in administrator mode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why doesn't this work? I am trying to create a registry key under [HKEY_LOCAL_MACHINE\SOFTWARE\MyService],
I am trying to create a registry key at following location but I am
Hi I am trying to create a registry key in C++ but I keep
I'm trying to add registry key : My.Computer.Registry.LocalMachine.CreateSubKey(SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\TESTKEY) but key is created under :
Been googling but I cant find out how to create a registry key itself,
I am trying to create an offline registry in memory using the offreg.dll provided
Trying to create a black line in my view to separate text blocks but
Trying to create a new Dedicated Cache Role in Windows Azure but get the
I have a problem when trying to create an XML file from registry. On
I am trying to modify a registry key that I have been told controls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.