C# 索引和计数必须引用字符串中的位置。参数名称:count

C# 索引和计数必须引用字符串中的位置。参数名称:count,c#,asp.net,parameters,count,C#,Asp.net,Parameters,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 D

我被这个错误弄疯了!完全错误是:

[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_加载的代码为:

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);
    }
当我在我的本地pc上执行代码时,它工作正常,问题出在ISS7上

我不明白如何解决这个错误。如果有人能帮我,我会非常感激的


谢谢

不能从字符串中删除13个字符,少于13个字符;这就是错误所说的。第一次转让后,Usuario的内容是什么

    Usuario = Request.ServerVariables["LOGON_USER"];
    Usuario = Usuario.Remove(0, 13);

请在C:\Users\User\documents\visual studio 2010\Projects\INV\Digi\u Proveedores\Digi\u Proveedores\Site.Master.Page\u Load(对象发送者,事件参数e)中共享代码,好吗?这看起来像C#;如果是的话,你能帮我把你的问题贴上标签吗?我已经更新了帖子。谢谢你的帮助。谢谢你,我能找到错误。windows身份验证存在问题。非常感谢你!