Custom login in 2.0 error

Posted on 2008-10-12
Last Modified: 2013-11-07
I decided to go against the custom membership provider that 2.0 provides and create my own login page using forms authentication ticket. However, when I run the code I get the following error:

Object must implement IConvertible

I've attempted to sort of convert 1.1 code into 2.0 code. I am decent at coding but by no means an expert at it.   I included my code here to hopefully see if anyone can tell me the error of my ways.

Please note that I don't have any desire to use the membership provider in 2.0 nor do I want to create a membership provider as I can't get that to work. I used to be fine with it in 1.1 just using the formsauthentication ticket. I think I can still do that in 2.0.

Thanks in advance for your help.
This is my button1_click event:

Dim breturn As Boolean

        breturn = verifyuser(loginname.Text, password.Text)

        If breturn = True Then

            Dim ticket As FormsAuthenticationTicket = New FormsAuthenticationTicket(loginname.Text, False, 5000)

            FormsAuthentication.RedirectFromLoginPage(loginname.Text, False)


            feedback.Text = "The Login Name and Password you typed in doesn't match our records"

        End If

This is my "verifiyuser" function:

Protected Function verifyuser(ByVal username As String, ByVal password As String) As Boolean

        Dim sdr As System.Data.SqlClient.SqlDataReader

        Dim con As SqlConnection = New SqlConnection("myconnectionstring)

        Dim breturn As Boolean

        Dim cmd As SqlCommand = New SqlCommand("login", con)

        cmd.CommandType = Data.CommandType.StoredProcedure

        cmd.Parameters.Add("@cologin", NVarChar, 255).Value = loginname

        cmd.Parameters("@cologin").Value = loginname


        sdr = cmd.ExecuteReader

        While sdr.Read

            If sdr("Password") = password Then

                breturn = True

            End If

        End While

        Return breturn

    End Function

This is my stored Procedure:

@cologin as nvarchar (max)




	select * from members where cologin = @cologin


Open in new window

Question by:smitty68521
  • 2

Accepted Solution

harwantgrewal earned 500 total points
ID: 22699921
Hi smitty68521
Have you gone through this URL ?

Author Closing Comment

ID: 31505478
This helped a great deal. I was able to get the steps done correctly. Thanks a bunch.

Expert Comment

ID: 22700000
Thanks smitty68521

Just for future alwasy try to search in Google first you will definately find answers there.


Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Preface In the first article: A Better Website Login System ( I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to dynamically set the form action using jQuery.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now