Hi, I need to save the inserted password on MSSQL as md5 encrypted one. Basicaly when the user inserts the password on the textbox, it must be encrypted before storing it on the MSSQL Database. How can I do that? This was made from DreamWeaver CS6.

Thank you

the code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_conn_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.TB_User (StrUserID, password, Email) VALUES (?, ?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, 25, Request.Form("StrUserID")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 50, Request.Form("password")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, 50, Request.Form("Email")) ' adLongVarChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "complete.html"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
Dim rsRegister
Dim rsRegister_cmd
Dim rsRegister_numRows

Set rsRegister_cmd = Server.CreateObject ("ADODB.Command")
rsRegister_cmd.ActiveConnection = MM_conn_STRING
rsRegister_cmd.CommandText = "SELECT StrUserID, password, Email FROM dbo.TB_User" 
rsRegister_cmd.Prepared = true

Set rsRegister = rsRegister_cmd.Execute
rsRegister_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#form1 div table tr td {
    color: #FFF;
}
</style>
</head>

<body>
<form action="<%=MM_editAction%>" method="post" name="form1" id="form1">
  <div align="left">
    <table width="304" height="140" align="left">
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Usuario:</td>
        <td><input name="StrUserID" type="text" value="" size="25" maxlength="18" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Password:</td>
        <td><input name="password" type="password" size="50" maxlength="20" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Email:</td>
        <td><input name="Email" type="text" value="" size="50" maxlength="50" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">&nbsp;</td>
        <td> <input type="submit" value="Registrar" /></td>
      </tr>
    </table>
    <input type="hidden" name="MM_insert" value="form1" />
  </div>
</form>
<p>&nbsp;</p>
</body>
</html>
<%
rsRegister.Close()
Set rsRegister = Nothing
%>

Recommended Answers

All 2 Replies

I'm not an expert on ASP.NET so, that's why i'm asking for help, where do I put and what do I put on that code for saving md5 input password? :D

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.