ASP Protected Pages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Anyone have any suggestions on how to get asp password protected webpages to
work? The code I have doesn't seem to work.

Thanks.
 
Jennifer said:
Anyone have any suggestions on how to get asp password protected
webpages to work? The code I have doesn't seem to work.

Thanks.

This is the page I invoke when deleting records from a DB.

If "mypassword" is entered, then the page "delete_from_guestbook.asp" is
called
If nothing is entered, then the page stays the same.
If an incorrect password is entered, then a prompt is given to enter the
correct password.

Because the password is in ASP, it is invisible to users.

There may be better ways, but it seems to work

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Guestbook Delete - Password Page</title>
<!-- External CSS Files -->
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div align="center">
<h3>Trevor L.s Guestbook</h3>
<h4>Delete Comment - Password</h4>
<%
Dim strPass
strPass = Request.Form("strPass")
If strPass = "mypassword" Then
%>
<script type="text/javascript">
location.href="delete_from_guestbook.asp"
</script>
<% Else %>
<form method="POST" action="delete_password.asp">
<span class="subheading">Enter password to go to delete page
<% If strPass <> "" Then %>
<p>
Incorrect Password<br />
Please Try again
</p>
<% End If %>
</span>
<p>
<input type="password" name="strPass" value="" size="20" class="inbox">
<input type="submit" value="Enter" name="B1" class="button">
</p>
</form>
<% End If %>
<p>
<input type="button" value="Back" onclick="history.back()">
</p>
</div>
</body>
</html>
 
Simple, but it works for a single user
- although the password should be much stronger than
Replace the javascript w/ ASP redirect and move yor redirer to the top of the page
- no need for the page to even render if the password is correct

<%
Dim strPass
strPass = Request.Form("strPass")
If strPass = "mypassword" Then Response.redirect "delete_from_guestbook.asp"
%>

<html><head>
<title>Guestbook Delete - Password Page</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head><body><div align="center">
<h3>Trevor L.s Guestbook</h3>
<h4>Delete Comment - Password</h4>
<span class="subheading">Enter password to go to delete page</span>
<% If strPass<>"" Then %>
<p> Incorrect Password - Please Try again </p>
<% End If %>
<form method="POST" action="delete_password.asp"><p>
<input type="password" name="strPass" value="" size="20" class="inbox">
<input type="submit" value="Enter" name="B1" class="button">
</p></form>
<p><input type="button" value="Back" onclick="history.back()"></p>
</div></body></html>


--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Jennifer wrote:
| > Anyone have any suggestions on how to get asp password protected
| > webpages to work? The code I have doesn't seem to work.
| >
| > Thanks.
|
| This is the page I invoke when deleting records from a DB.
|
| If "mypassword" is entered, then the page "delete_from_guestbook.asp" is
| called
| If nothing is entered, then the page stays the same.
| If an incorrect password is entered, then a prompt is given to enter the
| correct password.
|
| Because the password is in ASP, it is invisible to users.
|
| There may be better ways, but it seems to work
|
| <html>
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
| <title>Guestbook Delete - Password Page</title>
| <!-- External CSS Files -->
| <link rel="stylesheet" type="text/css" href="style.css" />
| </head>
| <body>
| <div align="center">
| <h3>Trevor L.s Guestbook</h3>
| <h4>Delete Comment - Password</h4>
| <%
| Dim strPass
| strPass = Request.Form("strPass")
| If strPass = "mypassword" Then
| %>
| <script type="text/javascript">
| location.href="delete_from_guestbook.asp"
| </script>
| <% Else %>
| <form method="POST" action="delete_password.asp">
| <span class="subheading">Enter password to go to delete page
| <% If strPass <> "" Then %>
| <p>
| Incorrect Password<br />
| Please Try again
| </p>
| <% End If %>
| </span>
| <p>
| <input type="password" name="strPass" value="" size="20" class="inbox">
| <input type="submit" value="Enter" name="B1" class="button">
| </p>
| </form>
| <% End If %>
| <p>
| <input type="button" value="Back" onclick="history.back()">
| </p>
| </div>
| </body>
| </html>
|
| --
| Cheers,
| Trevor L.
| [ Microsoft MVP - FrontPage ]
| MVPS Website: http://trevorl.mvps.org/
|
 
I don't need to delete records from a DB. I have a DB that asks for user
name and password via asp code, and that works fine, but the code given to me
to make other pages protected and accessed only by views after they have
successfully logged in doesn't work.

I used the code at this link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;825498

and used this part of the code:

• Password-protect other Web pages: To password-protect another Web page in
your Web site, you must save the file with an ASP file name extension, for
example, Mypage.asp, and then add the following two lines to the very top of
the file: <% @language="vbscript" %>
<!--#include virtual="/logon/_private/logon.inc"-->

The first line specifies that you are using Microsoft Visual Basic Scripting
Edition (VBScript) for your scripting language, and the second line includes
the user name and the password functionality from the logon include file that
you created earlier.

But it still doesn't work.

Jennifer



Trevor L. said:
Jennifer said:
Anyone have any suggestions on how to get asp password protected
webpages to work? The code I have doesn't seem to work.

Thanks.

This is the page I invoke when deleting records from a DB.

If "mypassword" is entered, then the page "delete_from_guestbook.asp" is
called
If nothing is entered, then the page stays the same.
If an incorrect password is entered, then a prompt is given to enter the
correct password.

Because the password is in ASP, it is invisible to users.

There may be better ways, but it seems to work

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Guestbook Delete - Password Page</title>
<!-- External CSS Files -->
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div align="center">
<h3>Trevor L.s Guestbook</h3>
<h4>Delete Comment - Password</h4>
<%
Dim strPass
strPass = Request.Form("strPass")
If strPass = "mypassword" Then
%>
<script type="text/javascript">
location.href="delete_from_guestbook.asp"
</script>
<% Else %>
<form method="POST" action="delete_password.asp">
<span class="subheading">Enter password to go to delete page
<% If strPass <> "" Then %>
<p>
Incorrect Password<br />
Please Try again
</p>
<% End If %>
</span>
<p>
<input type="password" name="strPass" value="" size="20" class="inbox">
<input type="submit" value="Enter" name="B1" class="button">
</p>
</form>
<% End If %>
<p>
<input type="button" value="Back" onclick="history.back()">
</p>
</div>
</body>
</html>

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
 
I used this code:

http://support.microsoft.com/default.aspx?scid=kb;en-us;825498

and the "Customize webpages" section at the bottom with

Password-protect other Web pages: To password-protect another Web page in
your Web site, you must save the file with an ASP file name extension, for
example, Mypage.asp, and then add the following two lines to the very top of
the file: <% @language="vbscript" %>
<!--#include virtual="/logon/_private/logon.inc"-->

doesn't work. The server is a windows server and the site does support ASP.

Jennifer
 
The path to the logon,inc is logon/_private/logon.inc
Is this the correct path? (I think probably not)

Change the include comment to

<!--#include virtual="/path/logon.inc"-->
where path is the folder or path leading to the folder containing your file
named logon.inc

If logon.inc is in the root folder, then use

<!--#include virtual="/logon.inc"-->

--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/

Jennifer said:
I don't need to delete records from a DB. I have a DB that asks for user
name and password via asp code, and that works fine, but the code given
to me
to make other pages protected and accessed only by views after they have
successfully logged in doesn't work.

I used the code at this link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;825498

and used this part of the code:

. Password-protect other Web pages: To password-protect another Web page
in
your Web site, you must save the file with an ASP file name extension,
for
example, Mypage.asp, and then add the following two lines to the very top
of
the file: <% @language="vbscript" %>
<!--#include virtual="/logon/_private/logon.inc"-->

The first line specifies that you are using Microsoft Visual Basic
Scripting
Edition (VBScript) for your scripting language, and the second line
includes
the user name and the password functionality from the logon include file
that
you created earlier.

But it still doesn't work.

Jennifer



Trevor L. said:
Jennifer said:
Anyone have any suggestions on how to get asp password protected
webpages to work? The code I have doesn't seem to work.

Thanks.

This is the page I invoke when deleting records from a DB.

If "mypassword" is entered, then the page "delete_from_guestbook.asp" is
called
If nothing is entered, then the page stays the same.
If an incorrect password is entered, then a prompt is given to enter the
correct password.

Because the password is in ASP, it is invisible to users.

There may be better ways, but it seems to work

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Guestbook Delete - Password Page</title>
<!-- External CSS Files -->
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div align="center">
<h3>Trevor L.s Guestbook</h3>
<h4>Delete Comment - Password</h4>
<%
Dim strPass
strPass = Request.Form("strPass")
If strPass = "mypassword" Then
%>
<script type="text/javascript">
location.href="delete_from_guestbook.asp"
</script>
<% Else %>
<form method="POST" action="delete_password.asp">
<span class="subheading">Enter password to go to delete page
<% If strPass <> "" Then %>
<p>
Incorrect Password<br />
Please Try again
</p>
<% End If %>
</span>
<p>
<input type="password" name="strPass" value="" size="20"
class="inbox">
<input type="submit" value="Enter" name="B1" class="button">
</p>
</form>
<% End If %>
<p>
<input type="button" value="Back" onclick="history.back()">
</p>
</div>
</body>
</html>

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
 
Yes, I already edited the comment so the path leads to the private folder
containing my file. I did that before I tried publishing the webpages.

Ronx said:
The path to the logon,inc is logon/_private/logon.inc
Is this the correct path? (I think probably not)

Change the include comment to

<!--#include virtual="/path/logon.inc"-->
where path is the folder or path leading to the folder containing your file
named logon.inc

If logon.inc is in the root folder, then use

<!--#include virtual="/logon.inc"-->

--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/

Jennifer said:
I don't need to delete records from a DB. I have a DB that asks for user
name and password via asp code, and that works fine, but the code given
to me
to make other pages protected and accessed only by views after they have
successfully logged in doesn't work.

I used the code at this link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;825498

and used this part of the code:

. Password-protect other Web pages: To password-protect another Web page
in
your Web site, you must save the file with an ASP file name extension,
for
example, Mypage.asp, and then add the following two lines to the very top
of
the file: <% @language="vbscript" %>
<!--#include virtual="/logon/_private/logon.inc"-->

The first line specifies that you are using Microsoft Visual Basic
Scripting
Edition (VBScript) for your scripting language, and the second line
includes
the user name and the password functionality from the logon include file
that
you created earlier.

But it still doesn't work.

Jennifer



Trevor L. said:
Jennifer wrote:
Anyone have any suggestions on how to get asp password protected
webpages to work? The code I have doesn't seem to work.

Thanks.

This is the page I invoke when deleting records from a DB.

If "mypassword" is entered, then the page "delete_from_guestbook.asp" is
called
If nothing is entered, then the page stays the same.
If an incorrect password is entered, then a prompt is given to enter the
correct password.

Because the password is in ASP, it is invisible to users.

There may be better ways, but it seems to work

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Guestbook Delete - Password Page</title>
<!-- External CSS Files -->
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div align="center">
<h3>Trevor L.s Guestbook</h3>
<h4>Delete Comment - Password</h4>
<%
Dim strPass
strPass = Request.Form("strPass")
If strPass = "mypassword" Then
%>
<script type="text/javascript">
location.href="delete_from_guestbook.asp"
</script>
<% Else %>
<form method="POST" action="delete_password.asp">
<span class="subheading">Enter password to go to delete page
<% If strPass <> "" Then %>
<p>
Incorrect Password<br />
Please Try again
</p>
<% End If %>
</span>
<p>
<input type="password" name="strPass" value="" size="20"
class="inbox">
<input type="submit" value="Enter" name="B1" class="button">
</p>
</form>
<% End If %>
<p>
<input type="button" value="Back" onclick="history.back()">
</p>
</div>
</body>
</html>

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
 
Back
Top