Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with ASP and html

Status
Not open for further replies.

taz97

Programmer
Jun 7, 2001
17
CA
Sorry for my english, i'm french canadian !

I have a html file (login.html). This file call valid.asp. In the file valid.asp , I validate the login/passwd. If the login is wrong, I call error.html with "Response.Redirect("error.html")". In the file error.html, I have a message like "Wrong passwd" and a button with redirection to login.html. The redirection not work !!!
This is my 3 files , if you want help me !
Thanks

LOGIN.HTML
<body>
<script language=&quot;JavaScript&quot;>

function espacevide()
{
if (document.formu.login.value == &quot;&quot;)
{
alert(&quot;Vous devez inscrire votre login s.v.p.&quot;)
document.formu.login.focus();
return false;
}
document.formu.submit();
}

// --></script>

<form action=&quot;valid.asp&quot; method=&quot;post&quot; name=&quot;formu&quot;>
<table border=0 bordercolor=#000000>
<tr>
<td width=111>Login:</td>
<td><input type=&quot;text&quot; name=&quot;login&quot; size=10 maxlength=10></td>
</tr>
<tr>
<td width=111 height=24>Mot de passe:</td>
<td height=24><input type=&quot;password&quot; name=&quot;password&quot; size=10 maxlength=10>
</td>
</tr>
</table>
<input type=&quot;button&quot; value=&quot;ENTRER&quot; onclick=&quot;espacevide()&quot;>
<input type=&quot;reset&quot; value=&quot;ANNULER&quot;>

</form>

</body>


VALID.ASP
<body>

<%
DIM login
DIM password

login = request.form(&quot;login&quot;)
password = Request.Form(&quot;password&quot;)


if (login=&quot;rros017&quot; and password=&quot;osaka98a&quot;) then
Response.Redirect(login & &quot;.html&quot;)

elseif (login=&quot;rdus019&quot; and password=&quot;repas03n&quot;) then
Response.Redirect(login & &quot;.html&quot;)
else
Response.Redirect(&quot;erreur.html&quot;)
end if
%>

</body>

ERREUR.HTML
</head>
Mauvais mot de passe !
****HERE FOR THE REDIRECTION OR IF IT'S POSSIBLE, IN THE ASP FILE, CHANGE &quot;Response.Redirect(&quot;erreur.html&quot;)&quot; FOR SOMETHING LIKE THAT: Message box said (Wrong passwd), click &quot;OK&quot; and return to login.html. With this, I don't need erreur.html
</html>
 
Response.Redirect(login & &quot;.html&quot;)

Should be:

Response.Redirect(&quot;login.html&quot;)
 
you could put all three in one asp file, posting the form back to itself and displaying the error and redisplaying the login form if passwords are wrong:

login.asp:

<body>
<script language=&quot;JavaScript&quot;>

function espacevide()
{
if (document.formu.login.value == &quot;&quot;)
{
alert(&quot;Vous devez inscrire votre login s.v.p.&quot;)
document.formu.login.focus();
return false;
}
document.formu.submit();
}

// --></script>


<%
DIM login
DIM password
DIM erreur

login = request.form(&quot;login&quot;)
password = Request.Form(&quot;password&quot;)

If request.Form(&quot;validate&quot;) = &quot;yes&quot; Then

if (login=&quot;rros017&quot; and password=&quot;osaka98a&quot;) then
Response.Redirect(login & &quot;.html&quot;)

elseif (login=&quot;rdus019&quot; and password=&quot;repas03n&quot;) then
Response.Redirect(login & &quot;.html&quot;)
else
erreur = &quot;Mauvais mot de passe !&quot;
end if

End If
%>

<form action=&quot;login.asp&quot; method=&quot;post&quot; name=&quot;formu&quot;>
<input type=&quot;hidden&quot; name=&quot;validate&quot; value=&quot;yes&quot;>
<table border=0 bordercolor=#000000>
<%
If erreur <> &quot;&quot; Then
%>
<tr>
<td colspan=&quot;2&quot;><%= erreur %></td>
</tr>
<%
End If
%>
<tr>
<td width=111>Login:</td>
<td><input type=&quot;text&quot; name=&quot;login&quot; size=10 maxlength=10></td>
</tr>
<tr>
<td width=111 height=24>Mot de passe:</td>
<td height=24><input type=&quot;password&quot; name=&quot;password&quot; size=10 maxlength=10>
</td>
</tr>
</table>
<input type=&quot;button&quot; value=&quot;ENTRER&quot; onclick=&quot;espacevide()&quot;>
<input type=&quot;reset&quot; value=&quot;ANNULER&quot;>

</form>

</body>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top