在往数据库中上传图片时出现这种情况,到底咋办啊
Server Error in '/WebApplication3' Application.
将截断字符串或二进制数据。
语句已终止。
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.Data.SqlClient.SqlException: 将截断字符串或二进制数据。
语句已终止。
Source Error:
Line 84: myCommand.Parameters["@imgdata"].Value = FileData;
Line 85:
Line 86: int iout = myCommand.ExecuteNonQuery();
Line 87:
Line 88: conn.Close();
Source File: c:\inetpub\wwwroot\webapplication3\webform3.aspx.cs Line: 86
Stack Trace:
在往wwwroot里上传图片和创建文件时时又出现这种情况,哎,各位高手多多赐教,小弟不胜感激不禁啊
Server Error in '/newsPublish' Application.
Access to the path 'C:\Inetpub\wwwroot\newsPublish\pic\Snap1.gif' 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\newsPublish\pic\Snap1.gif' 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 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 102: string fileName=filePath.Substring(filePath.LastIndexOf(@"\") + 1);
Line 103: string savePath=Server.MapPath("./pic").ToString() + "/" + fileName;
Line 104: this.filePicture.PostedFile.SaveAs(savePath);
Line 105:
Line 106: strIns="insert into news(title,content,auth,img,typeID) values('" + this.txtTitle.Text + "','" + this.txtContent.Text
Source File: c:\inetpub\wwwroot\newspublish\addnews.aspx.cs Line: 104