13 Ağustos 2012 Pazartesi

ASP.NET FileUpload ve Dosya Yazma Yetkilendirme Problemi ve Çözümü

ASPNETLokalde çalışan projenizi sunucuya gönderdikten sonra, File Upload kontrolünü kullanarak dosya yüklemek istediğinizde ya da sunucu üzerinde herhangi bir fiziksel dosya oluşturmak istediğinizde eğer uygun yetkilendirme yapılmamış ise aşağıdakine benzer bir hata alabilirsiniz.

 

Access to the path 'C:\inetpub\vhosts\site.adi.com.tr\httpdocs\Uploads\dosya.doc' 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\vhosts\site.adi.com.tr\httpdocs\Uploads\dosya.doc' 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:

Bu durum, sitenizin çalışmasını sağlayan kullanıcı hesabının ilgili klasör üzerinde işlem yapmaya yetkili olmamasından kaynaklanır. Bu kullanıcıya gerekli yetkileri vererek sorunu çözebilirsiniz.

IIS 5 kullanıyorsanız MAKİNAADI\ASPNET kullanıcısı, IIS 6 ve IIS 7 için IUSR_MAKİNAADI kullanıcısı, IIS 7.5 için de ApplicationPool’a bağlı olan kullanıcı için yetkilendirme yapmalısınız. Ayrıca eğer sisteminizde plesk yüklü ise yine hangi kullanıcı yönetimden sorumlu ise o kullanıcıya yetki vermek gerekir.

Hiç yorum yok: