471,592 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,592 software developers and data experts.

Access problems trying to access my log files

I am trying to access my log files and am running into a permissions
problem.

I am doing the following:

************************************************** ****************
private void PopulateSiteBox()
{
drpSiteBox.Items.Clear();
string FILE_PATH = @"\\" +txtMachine.Text +
@"\C$\windows\System32\LogFiles\";

Trace.Warn("FILE_PATH = " + FILE_PATH);

DirectoryInfo di = new DirectoryInfo(FILE_PATH);
foreach(FileSystemInfo fsi in di.GetFileSystemInfos())
{
if(fsi.Name.StartsWith("W3"))
drpSiteBox.Items.Add(fsi.Name);
}
}
************************************************** *******************

The error I am getting is on the GetFileSystemInfos() call. This is trying
to access:

FILE_PATH = \\sam\C$\windows\System32\LogFiles\

To get the W3... folder to get the name of the folder the ex040920.log is
in.

I tried to audit the folder LogFiles setting the success and failure to all
and to everyone. I wanted to find out what user is trying to access the
folder. I am not sure what user the asp.net is using.

The error I get is:

************************************************** ***************************
Access to the path "\\tfs\C$\windows\System32\LogFiles\" is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path
"\\tfs\C$\windows\System32\LogFiles\" is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the
boxes for the desired access.

************************************************** ****************************

As I said I did try to set the permissions to everyone to solve the problem
(temporarily). This is only on my WXP Pro machine so I am not concerned
with anyone getting access to my machine.

What do I need to set to make this work?

Thanks,

Tom.

Nov 19 '05 #1
5 2002
you cannot use a unc path, unless you give the asp.net account network
permisions. use

string FILE_PATH = @"C:\windows\System32\LogFiles\";

-- bruce (sqlwork.com)
"tshad" <ts**********@ftsolutions.com> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
| I am trying to access my log files and am running into a permissions
| problem.
|
| I am doing the following:
|
| ************************************************** ****************
| private void PopulateSiteBox()
| {
| drpSiteBox.Items.Clear();
| string FILE_PATH = @"\\" +txtMachine.Text +
| @"\C$\windows\System32\LogFiles\";
|
| Trace.Warn("FILE_PATH = " + FILE_PATH);
|
| DirectoryInfo di = new DirectoryInfo(FILE_PATH);
| foreach(FileSystemInfo fsi in di.GetFileSystemInfos())
| {
| if(fsi.Name.StartsWith("W3"))
| drpSiteBox.Items.Add(fsi.Name);
| }
| }
| ************************************************** *******************
|
| The error I am getting is on the GetFileSystemInfos() call. This is
trying
| to access:
|
| FILE_PATH = \\sam\C$\windows\System32\LogFiles\
|
| To get the W3... folder to get the name of the folder the ex040920.log is
| in.
|
| I tried to audit the folder LogFiles setting the success and failure to
all
| and to everyone. I wanted to find out what user is trying to access the
| folder. I am not sure what user the asp.net is using.
|
| The error I get is:
|
|
************************************************** **************************
*
| Access to the path "\\tfs\C$\windows\System32\LogFiles\" is denied.
| Description: An unhandled exception occurred during the execution of the
| current web request. Please review the stack trace for more information
| about the error and where it originated in the code.
|
| Exception Details: System.UnauthorizedAccessException: Access to the path
| "\\tfs\C$\windows\System32\LogFiles\" is denied.
|
| ASP.NET is not authorized to access the requested resource. Consider
| granting access rights to the resource to the ASP.NET request identity.
| ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
or
| Network Service on IIS 6) that is used if the application is not
| impersonating. If the application is impersonating via <identity
| impersonate="true"/>, the identity will be the anonymous user (typically
| IUSR_MACHINENAME) or the authenticated request user.
|
| To grant ASP.NET write access to a file, right-click the file in Explorer,
| choose "Properties" and select the Security tab. Click "Add" to add the
| appropriate user or group. Highlight the ASP.NET account, and check the
| boxes for the desired access.
|
|
************************************************** **************************
**
|
| As I said I did try to set the permissions to everyone to solve the
problem
| (temporarily). This is only on my WXP Pro machine so I am not concerned
| with anyone getting access to my machine.
|
| What do I need to set to make this work?
|
| Thanks,
|
| Tom.
|
|
|
|
|
Nov 19 '05 #2
"bruce barker" <no***********@safeco.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
you cannot use a unc path, unless you give the asp.net account network
permisions. use

string FILE_PATH = @"C:\windows\System32\LogFiles\";
I gave LogFiles Everyone access to everything ( I assume that that would
include the asp.net Account). Do I also have to do it for the "windows" and
"System32" folders?

How do I tell what the asp.net account is? That was what I was trying to do
when I set up auditing on the LogFiles folder, but there was nothing in the
event viewer for it.

Could that have been because it was actually getting the error on the
"windows" or "system32" folder?

Thanks,

Tom.
-- bruce (sqlwork.com)
"tshad" <ts**********@ftsolutions.com> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
| I am trying to access my log files and am running into a permissions
| problem.
|
| I am doing the following:
|
| ************************************************** ****************
| private void PopulateSiteBox()
| {
| drpSiteBox.Items.Clear();
| string FILE_PATH = @"\\" +txtMachine.Text +
| @"\C$\windows\System32\LogFiles\";
|
| Trace.Warn("FILE_PATH = " + FILE_PATH);
|
| DirectoryInfo di = new DirectoryInfo(FILE_PATH);
| foreach(FileSystemInfo fsi in di.GetFileSystemInfos())
| {
| if(fsi.Name.StartsWith("W3"))
| drpSiteBox.Items.Add(fsi.Name);
| }
| }
| ************************************************** *******************
|
| The error I am getting is on the GetFileSystemInfos() call. This is
trying
| to access:
|
| FILE_PATH = \\sam\C$\windows\System32\LogFiles\
|
| To get the W3... folder to get the name of the folder the ex040920.log
is
| in.
|
| I tried to audit the folder LogFiles setting the success and failure to
all
| and to everyone. I wanted to find out what user is trying to access the
| folder. I am not sure what user the asp.net is using.
|
| The error I get is:
|
|
************************************************** **************************
*
| Access to the path "\\tfs\C$\windows\System32\LogFiles\" is denied.
| Description: An unhandled exception occurred during the execution of the
| current web request. Please review the stack trace for more information
| about the error and where it originated in the code.
|
| Exception Details: System.UnauthorizedAccessException: Access to the
path
| "\\tfs\C$\windows\System32\LogFiles\" is denied.
|
| ASP.NET is not authorized to access the requested resource. Consider
| granting access rights to the resource to the ASP.NET request identity.
| ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
or
| Network Service on IIS 6) that is used if the application is not
| impersonating. If the application is impersonating via <identity
| impersonate="true"/>, the identity will be the anonymous user (typically
| IUSR_MACHINENAME) or the authenticated request user.
|
| To grant ASP.NET write access to a file, right-click the file in
Explorer,
| choose "Properties" and select the Security tab. Click "Add" to add the
| appropriate user or group. Highlight the ASP.NET account, and check the
| boxes for the desired access.
|
|
************************************************** **************************
**
|
| As I said I did try to set the permissions to everyone to solve the
problem
| (temporarily). This is only on my WXP Pro machine so I am not concerned
| with anyone getting access to my machine.
|
| What do I need to set to make this work?
|
| Thanks,
|
| Tom.
|
|
|
|
|

Nov 19 '05 #3
Hi Tom,
Did you get it working?
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #4
"Patrick Olurotimi Ige" <pa*********@crazyjohns.com.au> wrote in message
news:OM****************@TK2MSFTNGP14.phx.gbl...
Hi Tom,
Did you get it working?
Not yet.

I am going to try to put access permissions on a file in my asp.net
application folder and try to open it it and see who the user is.

This whole permission thing has always been my downfall. All the
local/global permissions has always driven me crazy when I am trying to set
up service or schedular task or stored procedure. It invariably happens
that there is some function I am trying to execute that needs some special
access permission that I need to figure out.

Tom
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #5
Hi Tom,
As Bruce explained you cannot use a unc path, unless you give the
asp.net account network permisions.
I have developed a similar application and i had to give asp.net
account network permisions(but uploading!)
What exact error are u getting now after granting ASP.NET.
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Peter Frost | last post: by
4 posts views Thread by RichB | last post: by
12 posts views Thread by Ron Weldy | last post: by
2 posts views Thread by Joey | last post: by
17 posts views Thread by DaveG | last post: by
5 posts views Thread by MikeJingJing | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.