标题:到底怎么回事啊?急啊
只看楼主
lietou
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-4-30
 问题点数:0 回复次数:2 
到底怎么回事啊?急啊

在往数据库中上传图片时出现这种情况,到底咋办啊

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

搜索更多相关主题的帖子: exception 数据库 execution occurred request 
2006-05-30 18:39
铲铲
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:34
帖 子:506
专家分:0
注 册:2006-5-2
得分:0 
System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\wwwroot\newsPublish\pic\Snap1.gif' is denied
很明显,访问被拒绝。

进行文件IO操作在ASP.NET中是使用ASPNET帐户进行操作的。ASPNET的帐户隶属于users用户组,必需在NTFS文件系统中为他们配置合适的权限。

铲铲是也
2006-05-30 19:27
小笨笨
Rank: 5Rank: 5
等 级:贵宾
威 望:19
帖 子:1169
专家分:0
注 册:2006-4-17
得分:0 

Exception Details: System.Data.SqlClient.SqlException: 将截断字符串或二进制数据。

数据库里的字段不够长。


欢迎光临我的博客: http://smallfools.blog./default.html
2006-05-31 09:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-68588-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.071185 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved