p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: ASP.NET Website Programming Problem-Design-Solution (http://p2p.wrox.com/forumdisplay.php?f=23)
-   -   Problems running ThePhile web app (http://p2p.wrox.com/showthread.php?t=219)

kiekar June 6th, 2003 05:32 AM

Problems running ThePhile web app
 
Hello,

I just recently purchased the book and downloaded the web app.
Each time I try to run the app I get a Security Exception.
Does anybody have an idea how I can correct this. Any help would
be much appreciated.

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Requested registry access is not allowed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SecurityException: Requested registry access is not allowed.]
   Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
   System.Diagnostics.EventLog.FindSourceRegistration (String source, String machineName, Boolean readOnly)
   System.Diagnostics.EventLog.SourceExists(String source, String machineName)
   System.Diagnostics.EventLog.SourceExists(String source)
   Wrox.ThePhile.Web.PhilePage.LogEvent(String message, EventLogEntryType entryType) in Q:\Wrox\ThePhile\PhilePage.cs:29
   Wrox.ThePhile.Web.PhilePage.PhilePage_Error(Object sender, EventArgs e) in Q:\Wrox\ThePhile\PhilePage.cs:54
   System.Web.UI.TemplateControl.OnError(EventArgs e)
   System.Web.UI.Page.HandleError(Exception e)
   System.Web.UI.Page.ProcessRequestMain()
   System.Web.UI.Page.ProcessRequest()
   System.Web.UI.Page.ProcessRequest(HttpContext context)
   System.Web.CallHandlerExecutionStep.Execute()
   System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously)

Thanks
Karl

Neo June 7th, 2003 05:56 PM

I think try to use impersonation first.
Add following code to your web.config file
-----------------------------------------------------------
<system.web>
...
    <identity impersonate="true" userName="Administrator" password="***yourPassword" />
...
</system.web>
-----------------------------------------------------------
and retry

Good Luck!

Neo
What the web can be.

Hal Levy June 7th, 2003 07:30 PM

You are REALLY suggesting that he put his administrator password in pain text in a config file that any user could read?



Hal Levy
Daddyshome, LLC

dikkjo June 9th, 2003 06:49 AM

Hi,

This error is related to the application permissions.
ThePhile use the event log to report the application errors.

In order to run this on w2k machine you have to edit your machine.config file and set the username to "SYSTEM" in the <processModel> tag.

On a w2k3 server (IIS6.0) in native mode it's a little bit trickier..:

you have to create a new "Application Pool" and set its Identity property to "Local System"

cheers.

Imar June 9th, 2003 07:09 AM

In addition to changing the permissions so your code runs fine, you may want to rethink the proposed solution altogether. The biggest problem with creating Event Logs at run time is security. When the possibility was first introduced with early versions of ASP.NET I thought it was quite cool. However, in the mean time Microsoft no longer recommends creating them at run time because of the permissions problems.

If you take a look at the Exception Management Application Block, you can see that the Event Log is now created at install time and then used at run time. This makes it far easier to use......

For more details and hints how to create the event logs, check out:
http://msdn.microsoft.com/library/de...ml/emab-rm.asp

Cheers,

Imar

TimRogers July 24th, 2003 07:39 PM

I changed the userName attribute of processModel (in <system.web>) to "SYSTEM". Then I rebooted. Unfortunately, I'm still getting the same security error. Any ideas why? (BTW, the password attribute is set to "AutoGenerate")

Thanks,

Tim Rogers

Quote:

quote:Originally posted by dikkjo
 Hi,

This error is related to the application permissions.
ThePhile use the event log to report the application errors.

In order to run this on w2k machine you have to edit your machine.config file and set the username to "SYSTEM" in the <processModel> tag.

On a w2k3 server (IIS6.0) in native mode it's a little bit trickier..:

you have to create a new "Application Pool" and set its Identity property to "Local System"

cheers.


All times are GMT -4. The time now is 06:40 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.