Query String Data Encryption after Receiveing

  • Dim strURLWithData As String


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


    Me.Page.Session("LoginName") = "rabia2"
    Me.Page.Session("paswrd") = "rabia2"
        LinkButton1.OnClientClick = "javascript:window.open('http://192.168.0.140/UADIReports/Security/SignIn.aspx?UserName=" & Me.Page.Session("LoginName").ToString & "&Password=" & Me.Page.Session("paswrd").ToString & "');"

       End Sub



    Function Login()
    Dim strName As String = "", strAge As String = ""
    strName = Me.Page.Session("UserName").ToString
    strAge = Me.Page.Session("Password").ToString
    Dim strURL As String = "Default.aspx?"
    If HttpContext.Current IsNot Nothing Then
    strURLWithData = strURL & EncryptQueryString(String.Format("UserName={0}&Password={1}", strName, strAge))
    Else
    End If
    End Function


    Public Function EncryptQueryString(ByVal strQueryString As String) As String


    Dim objEDQueryString As New EncryptDecryptQueryString()
    Return objEDQueryString.Encrypt(strQueryString, "r0b1nr0y")
    End Function






    Public Class EncryptDecryptQueryString


    Private key As Byte() = {}
    Private IV As Byte() = {&H12, &H34, &H56, &H78, &H90, &HAB, _
    &HCD, &HEF}


    Public Function Encrypt(ByVal stringToEncrypt As String, ByVal SEncryptionKey As String) As String


    Try
    key = System.Text.Encoding.UTF8.GetBytes(SEncryptionKey)
    Dim des As New DESCryptoServiceProvider()
    Dim inputByteArray As Byte() = Encoding.UTF8.GetBytes(stringToEncrypt)
    Dim ms As New MemoryStream()
    Dim cs As New CryptoStream(ms, des.CreateEncryptor(key, IV), CryptoStreamMode.Write)
    cs.Write(inputByteArray, 0, inputByteArray.Length)
    cs.FlushFinalBlock()
    Return Convert.ToBase64String(ms.ToArray())
    Catch e As Exception
    Return e.Message
    End Try


    End Function
    End Class

    for further details and related topics http://www.codecorner.somee.com/

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative