Click here to Skip to main content
15,914,820 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: System.IndexOutOfRangeException: There is no row at position 0 Pin
Venkatesh Mookkan13-Jun-07 19:41
Venkatesh Mookkan13-Jun-07 19:41 
GeneralRe: System.IndexOutOfRangeException: There is no row at position 0 Pin
Sophia Rekhi13-Jun-07 19:56
Sophia Rekhi13-Jun-07 19:56 
GeneralRe: System.IndexOutOfRangeException: There is no row at position 0 Pin
Venkatesh Mookkan13-Jun-07 20:05
Venkatesh Mookkan13-Jun-07 20:05 
GeneralRe: System.IndexOutOfRangeException: There is no row at position 0 Pin
Sophia Rekhi13-Jun-07 20:30
Sophia Rekhi13-Jun-07 20:30 
GeneralRe: System.IndexOutOfRangeException: There is no row at position 0 Pin
Venkatesh Mookkan13-Jun-07 20:41
Venkatesh Mookkan13-Jun-07 20:41 
Questionencrypt the coookies Pin
saravanan0513-Jun-07 18:13
saravanan0513-Jun-07 18:13 
AnswerRe: encrypt the coookies Pin
Sylvester george13-Jun-07 18:28
Sylvester george13-Jun-07 18:28 
QuestionRe: encrypt the coookies Pin
saravanan0513-Jun-07 19:11
saravanan0513-Jun-07 19:11 
Public Shared Function encrypt(ByVal val As String, ByVal seed As Byte()) As String
Dim KEY_64 As Byte()
KEY_64 = seed
Dim IV_64 As Byte() = New Byte(7) {55, 103, 246, 79, 36, 99, _
167, 3}
If val <> "" Then
Dim cryptoProvider As New DESCryptoServiceProvider
Dim ms As New MemoryStream
Dim cs As New CryptoStream(ms, cryptoProvider.CreateEncryptor(KEY_64, IV_64), CryptoStreamMode.Write)
Dim sw As New StreamWriter(cs)
sw.Write(val)
sw.Flush()
cs.FlushFinalBlock()
ms.Flush()
Return Convert.ToBase64String(ms.GetBuffer(), 0, Convert.ToInt32(ms.Length))
End If
Return ""
End Function




Public Shared Function decrypt(ByVal val As String, ByVal seed As String) As String
Dim KEY_64 As Byte() = Convert.FromBase64String(seed)
Dim IV_64 As Byte() = New Byte(7) {55, 103, 246, 79, 36, 99, _
167, 3}
If val <> "" Then
Dim cryptoProvider As New DESCryptoServiceProvider
Dim buffer As Byte() = Convert.FromBase64String(val)
Dim ms As New MemoryStream(buffer)
Dim cs As New CryptoStream(ms, cryptoProvider.CreateDecryptor(KEY_64, IV_64), CryptoStreamMode.Read)
Dim sr As New StreamReader(cs)
Return sr.ReadToEnd()
End If
Return ""
End Function



Public Shared Function CreateSalt(ByVal size As Integer) As Byte()
' Generate a cryptographic random number using the cryptographic service provider
Dim rng As New RNGCryptoServiceProvider
Dim buff As Byte() = New Byte(size - 1) {}
rng.GetBytes(buff)
' Return a Base64 string representation of the random number
Return buff
End Function





Private Sub butuser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butuser.Click

Dim username As String
Dim password As String
Dim checkbox As String


username = txtusername.Text
password = txtpassword.Text


If username <> "" Then
'if Username is not null
Dim salt As Array


salt = CreateSalt(8)
username = encrypt(username, salt)
'encrypting the password to salt 8 algorithm
username = username.Replace("'", "''")
End If
If password <> "" Then
Dim salt As Array
'if password is not null
salt = CreateSalt(8)
password = encrypt(password, salt)
'encrypting the password to salt 8 algorithm
password = password.Replace("'", "''")
End If

If (chkplayer.Checked = True) Then
Dim objCookie As New HttpCookie("UserInfo")
objCookie.Values.Add("UserName", username)
objCookie.Values.Add("Password", password)
objCookie.Expires = DateTime.Now.AddDays(1)
'this is for one day
Response.Cookies.Clear()
Response.Cookies.Add(objCookie)

End If



Dim conn As SqlConnection = New SqlConnection("server=Wafes10;database=lgateway;uid=;pwd=;Trusted_connection=true")
conn.Open()
Dim cmd As SqlCommand = New SqlCommand("select count (*) from register where uname='" + txtusername.Text + "' and password='" + txtpassword.Text + "'", conn)
Dim dr As SqlDataReader
dr = cmd.ExecuteReader
dr.Read()
Dim rowcount As String
rowcount = dr(0).ToString
dr.Close()

hi i used this code encrypted sucessfully

how can i decript the username,password saved in cookies
AnswerRe: encrypt the coookies Pin
Sylvester george13-Jun-07 19:24
Sylvester george13-Jun-07 19:24 
GeneralRe: encrypt the coookies Pin
saravanan0513-Jun-07 20:08
saravanan0513-Jun-07 20:08 
AnswerRe: encrypt the coookies Pin
Sathesh Sakthivel13-Jun-07 19:29
Sathesh Sakthivel13-Jun-07 19:29 
GeneralRe: encrypt the coookies Pin
saravanan0513-Jun-07 20:09
saravanan0513-Jun-07 20:09 
GeneralRe: encrypt the coookies Pin
Sathesh Sakthivel13-Jun-07 20:13
Sathesh Sakthivel13-Jun-07 20:13 
QuestionRe: encrypt the coookies Pin
saravanan0513-Jun-07 20:26
saravanan0513-Jun-07 20:26 
AnswerRe: encrypt the coookies Pin
Sathesh Sakthivel13-Jun-07 20:30
Sathesh Sakthivel13-Jun-07 20:30 
GeneralRe: encrypt the coookies Pin
saravanan0513-Jun-07 20:34
saravanan0513-Jun-07 20:34 
GeneralRe: encrypt the coookies Pin
Sathesh Sakthivel13-Jun-07 20:37
Sathesh Sakthivel13-Jun-07 20:37 
GeneralRe: encrypt the coookies Pin
saravanan0513-Jun-07 20:41
saravanan0513-Jun-07 20:41 
GeneralRe: encrypt the coookies Pin
Sylvester george13-Jun-07 20:45
Sylvester george13-Jun-07 20:45 
GeneralRe: encrypt the coookies Pin
saravanan0513-Jun-07 20:51
saravanan0513-Jun-07 20:51 
GeneralRe: encrypt the coookies Pin
saravanan0513-Jun-07 21:12
saravanan0513-Jun-07 21:12 
GeneralRe: encrypt the coookies Pin
saravanan0513-Jun-07 21:32
saravanan0513-Jun-07 21:32 
QuestionHelp using CTYPE [modified] Pin
ASPnoob13-Jun-07 17:58
ASPnoob13-Jun-07 17:58 
QuestionRe: Help using CTYPE Pin
Venkatesh Mookkan13-Jun-07 18:11
Venkatesh Mookkan13-Jun-07 18:11 
AnswerRe: Help using CTYPE Pin
ASPnoob13-Jun-07 18:16
ASPnoob13-Jun-07 18:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.