PDA

View Full Version : خطا در اپلود تصویر در سایت



FM.ALPACHINO
سه شنبه 10 اسفند 1389, 08:09 صبح
سلام دوستان
بنده تا قبل از پلود سایت ،در localhost هیچ مشکلی با اپلود تصاویر نداشتم اما حالا زمانی که می خواهم ای کار را
انجام دهم خطای زیر ظاهر می شود.لطفا اگر برای شما اشناست بفرمایید چگونه می توانم این خطا را بر طرف کنم




Server Error in '/' Application.

Access to the path 'D:\HostingSpaces\misagheshahed8.ir\misagheshahed8 .ir\wwwroot\image\A.jpg' 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 'D:\HostingSpaces\misagheshahed8.ir\misagheshahed8 .ir\wwwroot\image\A.jpg' 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 93: string FilePath = "/image/" + FileName;Line 94: string url = @"image\" + FileName;Line 95: FileUpload1.SaveAs(Server.MapPath("~") + FilePath);Line 96: txtActivities.Text += string.Format("<img src='{0}' alt='{1}' />", url, FileUpload1.FileName);Line 97:یا این :Source Error:

Line 71: //save the imageLine 72: saveFile = Path.Combine(savePath, FileUpload1.FileName);Line 73: FileUpload1.SaveAs(saveFile);Line 74: Line 75: // for product image we also create a thumbnail
Source File: d:\hostingspaces\misagheshahed8.ir\misagheshahed8. ir\wwwroot\Admin\Messages.aspx.cs Line: 95

با سپاس

keivan mousavi
سه شنبه 10 اسفند 1389, 11:13 صبح
رایت پرمیشن به فولدری که میخوای عکسو درونش آپلود کنی دادی؟؟؟

alonemm
سه شنبه 10 اسفند 1389, 14:07 عصر
با سلام:
همونطور که از متن خطا هم مشخص هست پوشه ای که شما در اون میخواید فایلی رو آپلود کنید مجوز نوشتن نداره.
راه حل:
به کنترل پنل سایت برید و در قسمت فایل منیجر پوشه مورنظر رو انتخاب کنید و مجوز نوشتن هم بهش بدید (777).


موفق باشید.