469,621 Members | 1,666 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

Server Error in Photos Application

Hi

I have an application using asp.net that I am running on my PC.

The web form has a text box where you can enter a name for a new Photo
category then click on the button.

The code is intended to create a new directory under Photos such as
"Relatives".

However, I am getting the following error message in IE (between the two
rows of @@@@:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Server Error in '/Photos' Application.
________________________________________
Access to the path "c:\inetpub\wwwroot\Photos\Relatives" 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
"c:\inetpub\wwwroot\Photos\Relatives" 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.

Source Error:

Line 38: strAppRoot = Server.MapPath("/Photos")
Line 39: strNewFolder = strAppRoot & "\" & strName
Line 40: Directory.CreateDirectory(strNewFolder)
Line 41: End Sub
Line 42:

Source File: c:\inetpub\wwwroot\photos\category.aspx Line: 40

Stack Trace:

[UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\Photos\Relatives" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String path)
+632
System.IO.Directory.CreateDirectory(String path) +195
ASP.category_aspx.CreateNewCategory(String strName) in
c:\inetpub\wwwroot\photos\category.aspx:40
ASP.category_aspx.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\photos\category.aspx:45
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

I have tried the tips in the above message, but to no avail. It is true to
say that I do not have a clear understanding of the part of the msg that says:

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.

So, if somebody could give me a hand I would appreciate it.

--
Kind regards

Ross Petersen
Nov 18 '05 #1
2 2014
Hi Ross,

I'm not sure what you don't understand, so forgive me if I tell you anything
you already know.

Every application running on an Operating System is called a process. If you
look in Task Manager, you can see all the processes running on your machine.
If you've never looked before, it can be quite enlightening to find out how
many processes are running on your machine when you have no programs running
at all. That is because services are processes too. They just run in the
background.

Every process that runs on your machine runs under the context of a User
account on your machine or domain. The User account determines what rights
that process has to access resources, such as the file sytem, on your
machine or domain. That should make clear the part of the message which
reads:
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
In case it is NOT clear to you now, I'll explain. The "process identity" is
the User account under which ASP.Net runs. Typically, it is a machine
identity or account, with the name "ASPNET" (on IIS) or "Network Service" on
IIS 6. It can be any account you specify in the machine.config file of the
machine.

By default, that User account has very limited permissions, as a security
measure. You can grant that user any permissions it needs if you are an
Administrator on your machine or domain.

In this case, the missing permission is:
[UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\Photos\Relatives" is denied.]
IOW, your ASP.Net process identity doesn't have permission to create a
directory under that path.

Solution: Grant the ASP.Net process identity (User account) the permission
it needs to create the folder.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

ASP.Net is a process which runs on your machine as well.
"Ross" <Ro**@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com... Hi

I have an application using asp.net that I am running on my PC.

The web form has a text box where you can enter a name for a new Photo
category then click on the button.

The code is intended to create a new directory under Photos such as
"Relatives".

However, I am getting the following error message in IE (between the two
rows of @@@@:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Server Error in '/Photos' Application.
________________________________________
Access to the path "c:\inetpub\wwwroot\Photos\Relatives" 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
"c:\inetpub\wwwroot\Photos\Relatives" 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.

Source Error:

Line 38: strAppRoot = Server.MapPath("/Photos")
Line 39: strNewFolder = strAppRoot & "\" & strName
Line 40: Directory.CreateDirectory(strNewFolder)
Line 41: End Sub
Line 42:

Source File: c:\inetpub\wwwroot\photos\category.aspx Line: 40

Stack Trace:

[UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\Photos\Relatives" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String path) +632
System.IO.Directory.CreateDirectory(String path) +195
ASP.category_aspx.CreateNewCategory(String strName) in
c:\inetpub\wwwroot\photos\category.aspx:40
ASP.category_aspx.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\photos\category.aspx:45
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

I have tried the tips in the above message, but to no avail. It is true to say that I do not have a clear understanding of the part of the msg that says:
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.

So, if somebody could give me a hand I would appreciate it.

--
Kind regards

Ross Petersen

Nov 18 '05 #2
Hi Kevin

Thanks very muchly - I shall give it a try - thanks for the really
good/clear explanation I really appreciate it.

You're bloods worth bottling.

Kind regards

Ross

"Kevin Spencer" wrote:
Hi Ross,

I'm not sure what you don't understand, so forgive me if I tell you anything
you already know.

Every application running on an Operating System is called a process. If you
look in Task Manager, you can see all the processes running on your machine.
If you've never looked before, it can be quite enlightening to find out how
many processes are running on your machine when you have no programs running
at all. That is because services are processes too. They just run in the
background.

Every process that runs on your machine runs under the context of a User
account on your machine or domain. The User account determines what rights
that process has to access resources, such as the file sytem, on your
machine or domain. That should make clear the part of the message which
reads:
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


In case it is NOT clear to you now, I'll explain. The "process identity" is
the User account under which ASP.Net runs. Typically, it is a machine
identity or account, with the name "ASPNET" (on IIS) or "Network Service" on
IIS 6. It can be any account you specify in the machine.config file of the
machine.

By default, that User account has very limited permissions, as a security
measure. You can grant that user any permissions it needs if you are an
Administrator on your machine or domain.

In this case, the missing permission is:
[UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\Photos\Relatives" is denied.]


IOW, your ASP.Net process identity doesn't have permission to create a
directory under that path.

Solution: Grant the ASP.Net process identity (User account) the permission
it needs to create the folder.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

ASP.Net is a process which runs on your machine as well.
"Ross" <Ro**@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com...
Hi

I have an application using asp.net that I am running on my PC.

The web form has a text box where you can enter a name for a new Photo
category then click on the button.

The code is intended to create a new directory under Photos such as
"Relatives".

However, I am getting the following error message in IE (between the two
rows of @@@@:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Server Error in '/Photos' Application.
________________________________________
Access to the path "c:\inetpub\wwwroot\Photos\Relatives" 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
"c:\inetpub\wwwroot\Photos\Relatives" 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.

Source Error:

Line 38: strAppRoot = Server.MapPath("/Photos")
Line 39: strNewFolder = strAppRoot & "\" & strName
Line 40: Directory.CreateDirectory(strNewFolder)
Line 41: End Sub
Line 42:

Source File: c:\inetpub\wwwroot\photos\category.aspx Line: 40

Stack Trace:

[UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\Photos\Relatives" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String

path)
+632
System.IO.Directory.CreateDirectory(String path) +195
ASP.category_aspx.CreateNewCategory(String strName) in
c:\inetpub\wwwroot\photos\category.aspx:40
ASP.category_aspx.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\photos\category.aspx:45
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.2032;

ASP.NET
Version:1.1.4322.2032

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

I have tried the tips in the above message, but to no avail. It is true

to
say that I do not have a clear understanding of the part of the msg that

says:

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.

So, if somebody could give me a hand I would appreciate it.

--
Kind regards

Ross Petersen


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by ScottM | last post: by
16 posts views Thread by Frankie | last post: by
5 posts views Thread by Shaqman | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.