Re: System.ComponentModel.Win32Exception: Access is denied
From: Nicole Calinoiu (calinoiu)
Date: 10/27/04
- Next message: Nicole Calinoiu: "Re: Security Policy Confusion..."
- Previous message: Rahul Kumar: "Re: general concerns regarding hacking of .NET assemblies"
- In reply to: DotNetJunkies User: "System.ComponentModel.Win32Exception: Access is denied"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 27 Oct 2004 07:38:07 -0400
The Windows user account that defines the user context for this process will
need read permissions on the following registry key in order to enable
reading from the system event log:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security.
If you're not sure how to verify or change permissions on a registry key,
see http://support.microsoft.com/default.aspx?scid=kb;en-us;310426.
If you're not sure how to verify or change the user context for your web
application, see
http://msdn.microsoft.com/library/en-us/dnnetsec/html/SecNetAP05.asp.
HTH,
Nicole
"DotNetJunkies User" <User@-NOSPAM-DotNetJunkies.com> wrote in message
news:eMgSXF$uEHA.3624@TK2MSFTNGP09.phx.gbl...
> hi
>
> while trying to execute the following program i am getting
> "System.ComponentModel.Win32Exception: Access is denied" as errror
> message.
>
>
> <% @Page Language="C#" %>
> <% @Import Namespace="System.Diagnostics" %>
> <script language="C#" runat="server">
> void Page_Load(Object sender, EventArgs e)
> {
> BindGrid();
> }
>
> void LogGrid_Change(Object sender, DataGridPageChangedEventArgs e)
> {
> // Set CurrentPageIndex to the page the user clicked.
> LogGrid.CurrentPageIndex = e.NewPageIndex;
>
> // Rebind the data.
> BindGrid();
> }
>
> void BindGrid()
> {
> EventLog aLog = new EventLog();
> aLog.Log = "System";
> aLog.MachineName = ".";
>
> LogGrid.DataSource = aLog.Entries;
> LogGrid.DataBind();
> }
> </script>
> <body bgcolor="#ffffff">
>
> <h3>System Event Log</h3>
>
> <form runat="server">
> <asp:DataGrid id="LogGrid" runat="server"
> AllowPaging="True"
> PageSize="10"
> PagerStyle-Mode="NumericPages"
> PagerStyle-HorizontalAlign="Right"
> PagerStyle-NextPageText="Next"
> PagerStyle-PrevPageText="Prev"
> OnPageIndexChanged="LogGrid_Change"
> BorderColor="black"
> BorderWidth="1"
> GridLines="Both"
> CellPadding="3"
> CellSpacing="0"
> Font-Name="Verdana"
> Font-Size="8pt"
> HeaderStyle-BackColor="#aaaadd"
> AutoGenerateColumns="false">
> <Columns>
> <asp:BoundColumn HeaderText="TOF" DataField="EntryType" />
> <asp:BoundColumn HeaderText="Date/Time" DataField="TimeGenerated"/>
> <asp:BoundColumn HeaderText="Source" DataField="Source"/>
> <asp:BoundColumn HeaderText="Event ID" DataField="EventID"/>
> </Columns>
> </asp:DataGrid>
> </form>
>
> </body>
> </html>
>
> ---
> Posted using Wimdows.net NntpNews Component -
>
> Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup
> engine supports Post Alerts, Ratings, and Searching.
- Next message: Nicole Calinoiu: "Re: Security Policy Confusion..."
- Previous message: Rahul Kumar: "Re: general concerns regarding hacking of .NET assemblies"
- In reply to: DotNetJunkies User: "System.ComponentModel.Win32Exception: Access is denied"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]