Welcome to Dream.In.Code
Getting Help is Easy!

Join 107,555 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,710 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



varify dictionary

 
Reply to this topicStart new topic

varify dictionary

rikki_max
post 1 May, 2008 - 05:31 AM
Post #1


New D.I.C Head

Group Icon
Joined: 19 Apr, 2007
Posts: 38



Dream Kudos: 100
My Contributions


I need to compare a username and password to a dictionary

CODE

        'get cookies
        Dim co1 As String
        Dim co2 As String
        co1 = "user"
        co2 = "pws"
        'create database
        Dim users As New Dictionary(Of String, String)
        ' Add items to the dictionary
        users.Add("rikki", "me")
        Dim cookie As New System.Web.HttpCookie(co1)
        Dim cookies As New System.Web.HttpCookie(co2)
        If cookie.Value = Nothing Then
            MsgBox("error1")
            Exit Sub
        ElseIf cookies.Value = Nothing Then
            MsgBox("error2")
            Exit Sub
        End If
        co1 = Request.Cookies(co1).Value
        co2 = Request.Cookies(co2).Value
        Dim key As System.Collections.Generic.KeyValuePair(Of String, String)
        For Each key In users
            'need to be able to compare co1 and co2 to key
            'co1 is username
            'co2 is password
        Next


I have made the code to get the username and password from a cookie
the database is a dictionary which needs to be searched
username as name
password as value nice and simple system
but then they must be compared to be seen as the same or not
User is offlineProfile CardPM

Go to the top of the page


mnn888
post 15 May, 2008 - 04:16 PM
Post #2


New D.I.C Head

*
Joined: 10 Dec, 2007
Posts: 18


My Contributions


Dim key As System.Collections.Generic.KeyValuePair(Of String, String)
For Each key In users
'Can't you access the key.Value and key.Key properties here?
Next




QUOTE(rikki_max @ 1 May, 2008 - 05:31 AM) *

I need to compare a username and password to a dictionary

CODE

        'get cookies
        Dim co1 As String
        Dim co2 As String
        co1 = "user"
        co2 = "pws"
        'create database
        Dim users As New Dictionary(Of String, String)
        ' Add items to the dictionary
        users.Add("rikki", "me")
        Dim cookie As New System.Web.HttpCookie(co1)
        Dim cookies As New System.Web.HttpCookie(co2)
        If cookie.Value = Nothing Then
            MsgBox("error1")
            Exit Sub
        ElseIf cookies.Value = Nothing Then
            MsgBox("error2")
            Exit Sub
        End If
        co1 = Request.Cookies(co1).Value
        co2 = Request.Cookies(co2).Value
        Dim key As System.Collections.Generic.KeyValuePair(Of String, String)
        For Each key In users
            'need to be able to compare co1 and co2 to key
            'co1 is username
            'co2 is password
        Next


I have made the code to get the username and password from a cookie
the database is a dictionary which needs to be searched
username as name
password as value nice and simple system
but then they must be compared to be seen as the same or not

User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/29/08 07:09AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month