473,765 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP Code Redirect Error SOS

12 New Member
ASP Code Redirect Error

Hello I recently relaunched a website containing asp code which used to work perfectly. However, after resetting up the SQL DB and trying to work out some site bugs I have the following problem: any suggestions?

I have a newuser login page that creates a new SQL DB table record with login name and password then takes the user to the next (page) step in the registration setup. Currently the record is created in the DB however the redirect doesn't occur. I get my asp message error (Msg = Msg & "An error occurred while creating the new account. " ) The following code is the newuser code:

<%
Option Explicit

on error resume next

Session("LoginN ame") = ""
Session("NewUse r") = True

dim adoCn
dim adoRs
dim SQL
dim Msg
dim TempChar
dim I

dim Account
dim Password

Account = trim(Request("t xtAccount"))
Password = trim(Request("t xtPassword1"))

Msg = ""

if len(Account) < 6 then
Msg = Msg & "The account name must be at least 6 characters long.<br>"
end if

if len(Password) < 6 then
Password = ""
Msg = Msg & "The password must be at least 6 characters long.<br>"
end if

for I = 1 to len(Account)
TempChar = asc(ucase(mid(A ccount, I , 1)))

if (((TempChar >= 48) and (TempChar <= 57)) or ((TempChar >= 65) and (TempChar <= 90))) = False then
Msg = Msg & "The account name you entered is invalid. "
Msg = Msg & "Please use only letters or numbers.<br>"
exit for
end if
next

for I = 1 to len(Password)
TempChar = asc(ucase(mid(P assword, I , 1)))

if (((TempChar >= 48) and (TempChar <= 57)) or ((TempChar >= 65) and (TempChar <= 90))) = False then
Password = ""
Msg = Msg & "The password you entered is invalid. "
Msg = Msg & "Please use only letters or numbers.<br>"
exit for
end if
next

if (Account <> "") and (Password <> "") then
if Password <> trim(Request("t xtPassword2")) then
Msg = Msg & "The retyped password is different than the first. "
Msg = Msg & "Please confirm the password.<br>"
else
SQL = "select * from tbRegistration "
SQL = SQL & "where (LoginName like '" & Account & "');"

set adoCn = Server.CreateOb ject("ADODB.Con nection")
adoCn.Open Session("SQLCon nect")

set adoRs = Server.CreateOb ject("ADODB.Rec ordset")
adoRs.Open SQL, adoCn, 1, 3

if adoRs.EOF then
adoRs.AddNew
adoRs("LoginNam e") = Account
adoRs("LoginPas sword") = Password
adoRs("DateRegi stered") = Date
adoRs("IsAdmin" ) = False
adoRs("RenewalA mount") = Session("Amount ")
adoRs.Update
else
Msg = Msg & "The account name you selected is already in use. "
Msg = Msg & "Please select another account name.<br>"
end if

adoRs.Close
adoCn.Close

set adoRs = Nothing
set adoCn = Nothing

if Err.Number <> 0 then
Err.Clear
Msg = Msg & "An error occurred while creating the new account. "
Msg = Msg & "Please try again.<br>"
end if

if Msg = "" then
Session("LoginN ame") = Account
Response.Redire ct("memreg.asp? mode=update")
Response.End
end if
end if
end if
%>
<html>

<head>
<title>New Member Account</title>
<meta name="Microsoft Border" content="l">
</head>


<form name="frmPost" method="POST" action="newuser .asp" onSubmit="retur n(Validate());" >
<table>
<tr>
<td valign="top" align="left" nowrap><font face="Arial" size="2"><b>Acc ount Name:</b><br><i>(6 chars minimum)</i></font></td>
<td valign="top" align="left" nowrap><input type="text" name="txtAccoun t" size="20" maxlength="20" value="<% =Account %>"></td>
</tr>
<tr>
<td valign="top" align="left" nowrap><font face="Arial" size="2"><b>Pas sword:</b><br><i>(6 chars minimum)</i></font></td>
<td valign="top" align="left" nowrap><input type="password" name="txtPasswo rd1" size="20" maxlength="20" value="<% =Password %>"></td>
</tr>
<tr>
<td valign="top" align="left" nowrap><font face="Arial" size="2"><b>Ret ype Password:</b><br><i>(6 chars minimum)</i></font></td>
<td valign="top" align="left" nowrap><input type="password" name="txtPasswo rd2" size="20" maxlength="20"> </td>
</tr>
</table>
<p><input type="submit" value="Next" name="btnNext"> </p>
</form>

<p><font face="Arial" size="2"><% =Msg %></font></p>

</td></tr>

</table>


</html>
<script LANGUAGE="javas cript">
<!--
function Validate() {
if (document.frmPo st.txtAccount.v alue.length < 6) {
alert("The account name must be at least 6 characters long.");
document.frmPos t.txtAccount.fo cus();
document.frmPos t.txtAccount.se lect();
return false;
}
if (!ValidateValue (document.frmPo st.txtAccount.v alue)) {
alert("The account name is invalid. Please enter only letters or numbers.");
document.frmPos t.txtAccount.fo cus();
document.frmPos t.txtAccount.se lect();
return false;
}
if (document.frmPo st.txtPassword1 .value.length < 6) {
alert("The password must be at least 6 characters long.");
document.frmPos t.txtPassword1. focus();
document.frmPos t.txtPassword1. select();
return false;
}
if (!ValidateValue (document.frmPo st.txtPassword1 .value)) {
alert("The password is invalid. Please enter only letters or numbers.");
document.frmPos t.txtPassword1. focus();
document.frmPos t.txtPassword1. select();
return false;
}
if (document.frmPo st.txtPassword1 .value != document.frmPos t.txtPassword2. value) {
alert("The retyped password does not match the first one.");
document.frmPos t.txtPassword2. focus();
document.frmPos t.txtPassword2. select();
return false;
}

return true;
}

function ValidateValue(I nputValue) {
var ValidChars = "ABCDEFGHIJKLMN OPQRSTUVWXYZabc defghijklmnopqr stuvwxyz0123456 789";
var IsValid = true;
var CheckChar;

for (var i=0; i < InputValue.leng th; i++) {
CheckChar = "" + InputValue.subs tring(i, i+1);
if (ValidChars.ind exOf(CheckChar) == "-1") IsValid = false;
}

return IsValid;
}
-->
</script>



thanks,

dragiton
drag.it.on@hotm ail.com
Apr 7 '08 #1
6 2443
danp129
323 Recognized Expert Contributor
get rid of the "on error resume next" and find out what line is having the problem and what the actual error message is.
Apr 7 '08 #2
dragiton
12 New Member
OK after removing the on error resume next line I get the following error:

ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/newuser.asp, line 73

And line 73 of the newuser page is the adoRs(RenewalAm ount) line as follows:

if adoRs.EOF then
adoRs.AddNew
adoRs("LoginNam e") = Account
adoRs("LoginPas sword") = Password
adoRs("DateRegi stered") = Date
adoRs("IsAdmin" ) = False
adoRs("RenewalA mount") = Session("Amount ")
adoRs.Update
else
Msg = Msg & "The account name you selected is already in use. "
Msg = Msg & "Please select another account name.<br>"
end if



any suggestions?? ??????
Apr 9 '08 #3
DrBunchman
979 Recognized Expert Contributor
Hi there,

This error means that the specified column (in this case RenewalAmount) cannot be found in the selected table (in this case tbRegistration) .

You'll need to check the database for the following:

Does the column RenewalAmount actually exist in the table tbRegistration?

Does the name RenewalAmount exactly match the name of the column in the database?

Let me know how you get on,

Dr B
Apr 9 '08 #4
dragiton
12 New Member
thanks so much that was it. I relaunched the website after both the DB and Site had been updated with new functionality. I didn't realize that was the case until now. I will just need to go through and update the DB to match the functionality now.

Thanks again.
Apr 10 '08 #5
dragiton
12 New Member
I wrote that wrong, the site DB was restored from a 2001 version of data. And the website files had updates from 2005. Thanks again.
Apr 10 '08 #6
DrBunchman
979 Recognized Expert Contributor
No problem, glad to be of help.

Dr B
Apr 10 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

10
9380
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?> Should it not redirect to www.google.com? I can't get the header() function to redirect. I'm trying to take an online reservation... the customer fills out
10
6975
by: Spam Bill Gates | last post by:
I am using linux, php and trying to do some ssl code. I want to send some identifier that connects my database to the client browser. I was looking into a secure cookie. I only want the page accessed over a SSL connection. Whats the best way to insure the clinet browser can only see my page if they are ssl connected to it? In adding a 1 to the end of my send cookie code, it sends the cookie regardless of if they are ssl connected or...
2
4049
by: D. Nii | last post by:
Hi there, I have a web application that recently got redesigned and now makes use of Response.Redirect . The "new" application is hosted on Win2000 and works for all kinds of clients using IE 5.0 + and different operating systems (Win2000, WinXP, WinME, Win98). Functions that use the Response.Redirect no longer work for clients using NT 4.0 SP6a IE 5.5 or IE 6.0.
2
3679
by: Kerri | last post by:
Hi, I have do some Redirects in my applitcaion. For example, when the use rhas logged in successfully I redirect them to a different page. In my Redirect all I was doing was a.. Response.Redirect("SomePage.aspx")
3
1385
by: Bishoy George | last post by:
Hi, I want an asp.net code for redirection: I have multiple domains pointing to one page , let's call it page0.aspx I want to put a code in page0.aspx so when domain1 opens page0.aspx it redirects it to page1.aspx when domain2 opens page0.aspx it redirects it to page2.aspx
6
4324
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx serves two purposes, 1. it contains a tab strip with response.redirects to navigate to the other pages; 2. I authenticate the user by check to see if a cookie exists, if it doesn't I redirect to a login screen.
6
2842
by: Nick Horrocks | last post by:
I have set up a custom error page for 404 errors. However the HTTP status code returned is 302 followed by 200, this causes search engines not to remove old pages from their index. How can I get the correct status code to be returned? Thanks
7
2909
by: Pat Carden | last post by:
I'm trying to provide a better user experience by redirecting my users to a "Page Not Found" page, using a Custom Errors directive in Web.Config. The problem is I need to return a 404 error code to the browser (or spider) before redirecting. Now, the system is reporting a status code of 302 on the original page and a 200 status code on the error page. I would like to use Google Sitemaps and they require this, plus I have a...
2
6454
by: farhad13841384 | last post by:
Hi , I Hope You fine. I have some problem with this code for paging in asp.net this bottom code work correctly without any error but when I try to place separate code in .VB file then error is begin and occured .I want to separate this code and compiling .vb code using VBC.exe later .(bin/paging.dll) when do it like me so you retrive only < Previous Page Next Page > in your web browser and you don't retrive list Of data in your web browser....
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.