programatically how to set the steps involved in enabling the ASP.



Hi all,
I am facing one problem while generating the entries in the EventLog in
That error is " registry access is not allowed". So i found some code in
the google regarding registry access. So i followed it and finally working

I set those permissions manually(Not programmatically). But i want it
programatically. The steps are given below.

Can you help me how to set the below steps programmatically.

1. Launch RegEdit
3. From the menu, select Edit->Permissions
4. Click the Add button and write ASPNET. (if ASP.NET is running under a
different user id, use that id instead)
5. Click OK.
6. Select the newly added user from the list (ASP.NET Machine User by
7. Click on Full Control in the Allow column.
8. Click OK.

It is usually a good idea at this point to restart IIS with the IISReset
command (Start | Run | IISReset).

Srihari k

Kevin Spencer

You're barking up the wrong tree, Srihari. You can't modify the Registry if
you don't have permission to use the Registry.

You certainly can modify the Registry programmatically, using the
Microsoft.Win32 .Registry and Microsoft.Win32.RegistryKey classes, but
again, you wouldn't be able to if you don't have permission.

You CAN use the WindowsIdentity class (and some unmanaged code) to
impersonate a user account that has whatever permissions your app needs, as
long as you know the domain, user name, and password for that account. See:


Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question