LoingBanner.ascx Error

Topics: Help
Nov 8, 2007 at 10:21 PM
Hi Everyone,
I keep getting this error when you hit to logout on the loginbanner.ascx... you can login fine and register fine, but once you are logged in and hit log out you get this error:

Server Error in '/' Application.

Count cannot be less than zero.
Parameter name: count
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: Count cannot be less than zero.
Parameter name: count

Source Error:

Line 13: st = str.Remove(0, 1)
Line 14: count = st.IndexOf("/"c)
Line 15: st = st.Remove(0, count)
Line 16: st = "~" & st
Line 17: Return st

Source File: d:\hosting\naturalgolf\UserControls\LoginBanner.ascx Line: 15

Stack Trace:

[ArgumentOutOfRangeException: Count cannot be less than zero.
Parameter name: count]
System.String.Remove(Int32 startIndex, Int32 count) +0
ASP.LoginBanner.GetFileName(String str) in d:\hosting\naturalgolf\UserControls\LoginBanner.ascx:15
ASP.LoginBanner.Logoutbtn_Click(Object sender, EventArgs e) in d:\hosting\naturalgolf\UserControls\LoginBanner.ascx:7
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Thanks in advance,
Mar 3, 2008 at 3:13 PM
Has anybody figured this out? I am having th same problem. Thanks
May 14, 2008 at 5:05 PM
i changed the code as follows on the loginbanner.ascx

    Private Function GetFileName(ByVal str As String) As String
        Dim st As String
        st = str
        st = "~" & st
        Return st
    End Function