Link to home
Start Free TrialLog in
Avatar of nirisan
nirisan

asked on

Change VBScript to Vb.net and convert asp page to aspx page

Hi

I want to convet an asp page to aspx page using vb.net.
The below is the code for the whole page. The main part is to convert the vbscript part hightlighted in the code

The page also send email and I can use existing mail sending classes to do that part.
**************************this part of the code needs changing********************
<%@ Language=VBScript %>
<%
strID = CDbl(Request("strID"))
strLastname = Replace(Request.Form("strLastname"),"'","''")
strDocumentation = Replace(Request.Form("strDocumentation"),"'","''")
 
Set conn = Server.CreateObject("ADODB.Connection")
conn.open Application("app1")
 
'copy old record to history table and add documentation
conn.execute("INSERT INTO accounts_history (accountid,firstname,lastname,address,city,zip,state,country,email,password,created,consent1,consent2,access, documentation) SELECT accountid,firstname,lastname,address,city,zip,state,country,email,password,created,consent1,consent2,access,'" & strDocumentation & "' as documentation FROM accounts where accountid = " & strID)
		
Set ds = Server.CreateObject("ADODB.Recordset")
ds.Open "SELECT * FROM accounts WHERE accountid = " & strID & "", conn, 1, 2
		
ds("lastname") = strLastname
 
 
intAccountID = ds("accountid")
strEmail = ds("email")
strPassword = ds("password")
	
ds.Update
ds.Close
Set ds = Nothing
 
conn.Close
Set conn = Nothing
 
'Response.Redirect("http://www.mypage.com/usst/")
%>
 
************************************************************************************
 
 
<html>
<head>
<title>Mypage Inc. - Sareholder Register</title>
</head>
<body>
<h1>My page Register</h1>
<a HREF="Index.asp">Main Menu</a> &gt; Search Results &gt; Update Last Name
<p>
 
 
<font color="red">Account information has been updated. (<em><%= Now()%></em>)</font>
<p>
<form action="http://www.mypage.com/usst/SearchResults.asp" method="GET" id="form1" name="form1">
Search by <strong>last name:</strong>&nbsp;<input type="text" id="text1" name="text1"><input type="submit" value="Search" id="submit1" name="submit1"><br>
Search by <strong>account number</strong>&nbsp;<input type="text" id="text2" name="text2"><input type="submit" value="Search" id="submit2" name="submit2">
</form>	
<hr>
 
<%
 
strBody = "Dear Stockholder:" & vbCrLf & vbCrLf & "This is to confirm that we completed the update of your account information per your request." & vbCrLf & vbCrLf
strBody = strBody & "This is an automatically generated post only e-mail. Please do not reply." & vbcrlf & vbcrlf
strBody = strBody & "To view your account statement online, please visit the following URL:" & vbcrlf & "http://www.mypage.com/ir/?id=" & intAccountID & "&pw=" & strPassword & vbcrlf & vbcrlf & vbcrlf
strBody = strBody & "For all other shareholder services, please visit our investor relations Web site at:" & vbcrlf & "http://www.mypage.com/ir/" & vbcrlf & vbcrlf
strBody = strBody & "Account Number:     " & intAccountID & vbcrlf & vbcrlf & "Password:           " & strPassword & vbcrlf & vbcrlf & vbcrlf 
strBody = strBody & "Best regards," & vbcrlf & vbcrlf & "Mypage" & vbcrlf & vbcrlf
strBody = strBody & "---" & vbCrLf & "THE INFORMATION CONTAINED IN THIS E-MAIL IS PROVIDED 'AS IS'"
 
Set Mailer = CreateObject("CDONTS.NewMail")
Mailer.From = """Mypage Inc.""<mail@mypage.com>"
Mailer.To = strEmail
Mailer.Subject = "Confirmation"
Mailer.Body = strBody
Mailer.Send
Set Mailer = Nothing
		
%>
The following email has been sent to <b><code><%=strEmail%></code></b><p>
	
<code>
<%=replace(strBody,vbCrLf,"<br>")%>
</code>
 
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial