2015-04-07 44 views
0

'/图片'应用程序中的服务器错误。网站链接上的错误

源错误:

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.

堆栈跟踪:

[ArgumentOutOfRangeException: Index and count must refer to a location within the string.Parameter name: count] 
    System.String.Remove(Int32 startIndex, Int32 count) +0 
    _Default.Page_Load(Object sender, EventArgs e) +114 
    System.Web.UI.Control.OnLoad(EventArgs e) +99 
    System.Web.UI.Control.LoadRecursive() +50 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 
+2

您是否有一些错误引用的代码。 – 9Deuce

+0

它是一段相当大的代码,并不完全确定错误发生在哪里。任何想法在代码上的错误是什么?显然它是一个字符串。只是不明白错误 –

+0

在下面回答。 – 9Deuce

回答

0

好像你调用此方法,同时通过整数值的字符串的开始索引和数量删除对字符串无效的内容。例如,如果您的字符串长度为5个字符,则startIndex必须介于0和4之间,count基本上为4-startIndex。您不能从4个字符的字符串中删除7个字符。如果字符串只有4个字符,您也不能将起始索引设置为8。

这就是ArgumentOutOfRangeException是。您作为参数传递给方法的参数超出了适用于该字符串的可接受范围。

这就是为什么我以前要求代码很重要,因为我们可能会发现代码的哪个部分正在创建或将不正确的值传递给该方法。