索引和计数必须引用字符串中的位置。参数名称:计数
Index and count must refer to a location within the string. Parameter name: count
这个错误让我很生气!完整的错误是:
[ArgumentOutOfRangeException: Index and count must refer to a location within the string.
Parameter name: count]
System.String.RemoveInternal(Int32 startIndex, Int32 count) +0
System.String.Remove(Int32 startIndex, Int32 count) +22
Digi_Proveedores.SiteMaster.Page_Load(Object sender, EventArgs e) in C:\Users\User\documents\visual studio 2010\Projects\INV\Digi_Proveedores\Digi_Proveedores\Site.Master.cs:16
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Digi_Proveedores.SiteMaster.Page_Load的代码是:
protected void Page_Load(object sender, EventArgs e)
{
string Usuario;
Usuario = Request.ServerVariables["LOGON_USER"];
Usuario = Usuario.Remove(0, 13);
DBConnection Mov = new DBConnection();
lbl_User.Text = Mov.ConsultaUsuario(Usuario);
}
当我在本地电脑上执行代码时,它工作正常,问题出在 ISS7。
我不明白如何解决这个错误。如果有人能提供帮助,我将不胜感激。
谢谢!
您不能从字符串中删除 13 个字符,包含少于 13 个;这就是错误所说的。第一次赋值后Usuario的内容是什么?
Usuario = Request.ServerVariables["LOGON_USER"];
Usuario = Usuario.Remove(0, 13);
这个错误让我很生气!完整的错误是:
[ArgumentOutOfRangeException: Index and count must refer to a location within the string.
Parameter name: count]
System.String.RemoveInternal(Int32 startIndex, Int32 count) +0
System.String.Remove(Int32 startIndex, Int32 count) +22
Digi_Proveedores.SiteMaster.Page_Load(Object sender, EventArgs e) in C:\Users\User\documents\visual studio 2010\Projects\INV\Digi_Proveedores\Digi_Proveedores\Site.Master.cs:16
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Digi_Proveedores.SiteMaster.Page_Load的代码是:
protected void Page_Load(object sender, EventArgs e)
{
string Usuario;
Usuario = Request.ServerVariables["LOGON_USER"];
Usuario = Usuario.Remove(0, 13);
DBConnection Mov = new DBConnection();
lbl_User.Text = Mov.ConsultaUsuario(Usuario);
}
当我在本地电脑上执行代码时,它工作正常,问题出在 ISS7。
我不明白如何解决这个错误。如果有人能提供帮助,我将不胜感激。
谢谢!
您不能从字符串中删除 13 个字符,包含少于 13 个;这就是错误所说的。第一次赋值后Usuario的内容是什么?
Usuario = Request.ServerVariables["LOGON_USER"];
Usuario = Usuario.Remove(0, 13);