 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

June 14th, 2011, 12:25 PM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
IIS Config
I am currently running Windows 7 with IIS 7.5, and keep getting the following error message
Code:
Server Error in '/AdManagement' Application.
Access to the path 'C:\Users\BenS\Documents\AdManagement\AdManagement\Images\' 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:\Users\BenS\Documents\AdManagement\AdManagement\Images\' 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 and IIS 7, and the configured application pool identity on IIS 7.5) 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 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 74:
Line 75: oldFileName = DropDownList2.SelectedValue
Line 76: File.Delete(path & oldfilename)
Line 77: File.Delete(path & "/Thumbnails/" & uploadedFileName)
Line 78: 'File.Delete(Server.MapPath("Images"))
Source File: C:\Users\BenS\Documents\AdManagement\AdManagement\AdsServing.aspx.vb Line: 76
Stack Trace:
[UnauthorizedAccessException: Access to the path 'C:\Users\BenS\Documents\AdManagement\AdManagement\Images\' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +9726046
System.IO.File.Delete(String path) +9563972
_Default.DetailsViewSelectedAd_ItemUpdating(Object sender, DetailsViewUpdateEventArgs e) in C:\Users\BenS\Documents\AdManagement\AdManagement\AdsServing.aspx.vb:76
System.Web.UI.WebControls.DetailsView.OnItemUpdating(DetailsViewUpdateEventArgs e) +137
System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg, Boolean causesValidation) +680
System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +425
System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +112
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +124
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5348
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
For all users on the computer, I've set the "highest" permissions for this folder - I don't know what else to do at this point! I've tried using NetworkService and DefaultAppPool to run it...any suggestions?
|
|

June 14th, 2011, 12:40 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You shouldn't run IIS sites in *your* documents folder. Move the site to something like C:\Sites or C:\inetpub\wwwroot\ and then configure the permissions.
Cheers,
Imar
|
|

June 14th, 2011, 12:57 PM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Still getting the same error....
|
|

June 14th, 2011, 01:04 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Then you need to provide more information, such as:
Settings of IIS
Exact path
Does the path exist when you copy and paste it to Windows Explorer?
Permissions you're applying
Imar
|
|

June 15th, 2011, 11:03 AM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am using DefaultAppPool, whose identity is set to ApplicationPoolIdentity. The following users have been given Modify, Read & execute, List folder contents, Read, and Write permissions (what is the safest level of permissions to use if the program needs to write to the disk?): ASP.NET v4.0, DefaultAppPool, IIS_IUSRS, Administrators, HomeUsers, Network Service, System, and IUSR. I am granting permissions to the folder containing the web project files, and that path is a real path that opens in Windows explorer.
Thanks
|
|

June 15th, 2011, 12:59 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
and that path is a real path that opens in Windows explorer.
|
And what is that path exactly.
Did you use the "IIS AppPool\DefaultAppPool" account?
Also, are you following the instructions in chapter 19 and appendix B?
Imar
|
|
 |
|