Hello guys I'm developing a web site in which users can upload their own contents. But due the deployment on the live server a little problem appeared when users upload images. Something strange happens ASP.NET gives the usual exception with message
-----------------------ERROR---------------------------------------------
Access to the path "D:\PROJECTS\RATEIT\WEB\RateItWebClient\content\ima ges\img-category33.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:\PROJECTS\RATEIT\WEB\RateItWebClient\content\ima ges\img-category33.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) 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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[UnauthorizedAccessException: Access to the path "D:\PROJECTS\RATEIT\WEB\RateItWebClient\content\ima ges\img-category33.jpg" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode) +52
System.Web.HttpPostedFile.SaveAs(String filename) +48
RateItWebClient.EditCategory.doUpload(Int32 uniqueId, String& imgFilename) in c:\inetpub\wwwroot\RateIt_Last\RateItWebClient\Edi tCategory.aspx.vb:101
RateItWebClient.EditCategory.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\RateIt_Last\RateItWebClient\Edi tCategory.aspx.vb:139
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
-------------------------------------------------------------------------
The message above usually appears when the IIS DEFAULT USER is trying to access a file and has not enough permissions to do it. But on my application this happens only with the following types of images
*.jpg
*.gif
On the other side the content uploading works perfectlly for the following types of images
*.bmp
*.png
--------------SOURCE CODE-----------------------------------------
If ImageFile.PostedFile.ContentType = "image/jpeg" Or ImageFile.PostedFile.ContentType = "image/gif" Or ImageFile.PostedFile.ContentType = "image/png" Or ImageFile.PostedFile.ContentType = "image/pjpeg" Or ImageFile.PostedFile.ContentType = "image/x-png" Or ImageFile.PostedFile.ContentType = "image/bmp" Then
Try
ImageFile.PostedFile.SaveAs(strFilPathName & strFileSaveAs)
Me.imageName = strFileSaveAs
statusMsg.Text = "OK"
Catch exc
statusMsg.Text = "FAILED"
End Try
--------------END OF SOURCE CODE--------------------------------------

I checked MIME types on IIS but everything seems to be fine. Does anyone has any idea what is going wrong???

Thanks in advance