• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 613
  • Last Modified:

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


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")
Set ds = Nothing
Set conn = Nothing
<title>Mypage Inc. - Sareholder Register</title>
<h1>My page Register</h1>
<a HREF="Index.asp">Main Menu</a> &gt; Search Results &gt; Update Last Name
<font color="red">Account information has been updated. (<em><%= Now()%></em>)</font>
<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">
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
Set Mailer = CreateObject("CDONTS.NewMail")
Mailer.From = """Mypage Inc.""<mail@mypage.com>"
Mailer.To = strEmail
Mailer.Subject = "Confirmation"
Mailer.Body = strBody
Set Mailer = Nothing
The following email has been sent to <b><code><%=strEmail%></code></b><p>

Open in new window

1 Solution
David H.H.LeeCommented:
Hi nirisan,
There are a vast topic to aspx conversion. This asp.net official site can guide you the important steps regarding the necessary changes should be take for asp convert to aspx.

If you tend to use existing asp code under asp.net environment, the easiest solution is add aspcompat mode and remain the existing vbscript that running behind.
<%@ Page AspCompat="true" Language="VB" %>

Check this MSDN descriptions:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now