Server Error in '/' Application.

Index and length must refer to a location within the string.
Parameter name: length

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.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length

Source Error:


Line 963:                if (Request.Cookies["TungTang_User"] == null || Request.Cookies["TungTang_User"].Value.ToString() == "")
Line 964:                {
Line 965:                    Phone = Phone.Substring(0, 7) + "***";
Line 966:                    btnXemTrang.Attributes.Add("href", "/dang-nhap/dn");
Line 967:                    infopay.Attributes.Add("href", "/dang-nhap/dn");

Source File: c:\inetpub\vhosts\tungtang.com.vn\tungtang.com.vn\PostDetail.aspx.cs    Line: 965

Stack Trace:


[ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +13025971
   TinDangChiTiet.loadContactInfo(String ownerId) in c:\inetpub\vhosts\tungtang.com.vn\tungtang.com.vn\PostDetail.aspx.cs:965
   TinDangChiTiet.LoadTinDang() in c:\inetpub\vhosts\tungtang.com.vn\tungtang.com.vn\PostDetail.aspx.cs:236
   TinDangChiTiet.Page_Load(Object sender, EventArgs e) in c:\inetpub\vhosts\tungtang.com.vn\tungtang.com.vn\PostDetail.aspx.cs:59
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +85
   System.Web.UI.Control.OnLoad(EventArgs e) +79
   System.Web.UI.Control.LoadRecursive() +130
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2853


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3701.0