navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Frontpage2003 and ASP database problem

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Frontpage2003 and ASP database problem
Page: [1]
 
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
Frontpage2003 and ASP database problem - 8/4/2004 15:20:24   
Hi
Can anyone help me regarding the following query:-
I am following the steps based on an Article given in Microsoft site

"How to Create a Password-Protected Web Page by Using Microsoft Office FrontPage 2003, Active Server Pages (ASP), and a Microsoft Access database"

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

but some how the logon page and the password protected page both of them are not working.

If Any of you have any idea about this problem do reply

I am doing exactly what is given but still its not working:)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 15:22:22   
I just forgot to mention that instead of Access i am using Excel file as Database

(in reply to MariaK)
BeTheBall

 

Posts: 6354
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 15:33:27   
When you say, "It isn't working", are you getting an error message? Why Excel? I wouldn't recommend Excel for this type of thing, unless you have absoluted no choice. Have you considered the Spooky Login? That will provide you a very secure, easy to use system for protecting any page(s) you wish. I highly recommend it for its ease of use and because at $29.95 it will save you hours of programming and debugging. In fact, if the price is too high, try the free version.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MariaK)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 15:45:23   
No there are no error messages just the page is not coming up in the browser, it shows the page cannot be displayed.

The problem behind using Excel is that the company for whom i am designing the website want it like that as its easier for them to maintain and use the database file. i don't have any other options left except using Excel.

I have not tried using Spooky Login, moreover i don't want to spend as its not for my personal use. anyway, i will try the free version, otherwise i really surprised by the fact that how the steps given in microsoft site isn't working??

(in reply to BeTheBall)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 16:06:08   
Hi Duane,
i just looked at the free version of spooky login, but The backend is again Access:)

The purpose is almost same but it can be a simpler one like nothing related to mailing lost password. Have you got any other alternative.

I just want to protect few pages( the white paper pages), The whitepaper pages should only be accessible if the user registers for the first time and logins for his next visit.

This Microsoft thing was quiet easy but not working have anyone got any other alternative

(in reply to BeTheBall)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 17:28:34   
Can you post the code from the page that isn't working?

When it says page cannot be displayed, is there an error number?

Make sure that you have your browser set up to give you errors... rather than "Friendly HTTP error messages"

There should be an error and a brief description... if not it's probably not your code, it could be a server issue. Make sure your server supports ASP and that it's activated by the host.

Also, make sure the page name is spelled correctly so you're not redirecting or posting to a page that doesn't exist on your server (sounds obvious, but one typo can have you guessing for hours)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to MariaK)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 17:30:19   
quote:

The purpose is almost same but it can be a simpler one like nothing related to mailing lost password. Have you got any other alternative.

Are you managing multiple user ID's ? Or one password for everybody?

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to bobby)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 17:46:27   
Only one password for each user

and the code for logon.asp is :-
<%
	'Was this page posted to?
	
	if UCase(Request.ServerVariables("HTTP_METHOD"))="POST"
	 Then
			'if so, check the username/password that was entered.
		if ComparedPassword(Request("UID"),Request("PWD"))
		 Then
		 		'if comparision was good, store the user name...
		 	Session("UID")=Request("UID")
		 		'......and redirect back to the original page.
		 	Response.Redirect Session("REFERRER")
		end if
	end if
%>

<html>

<head>
<title>Logon Page</title>
<style>
body  { font-family: arial, helvetica }
table { background-color: #cccccc; font-size: 9pt; padding: 3px }
td    { color: #000000; background-color: #cccccc; border-width: 0px }
th    { color: #ffffff; background-color: #0000cc; border-width: 0px }
</style>
</head>
<body bgcolor="#000000" text="#ffffff">
<h3 align="center"> </h3>
<div align="center"><center>
<form action="<%=LOGON_PAGE%>" method="POST">
<table border="2" cellpadding="2" cellspacing="2">
  <tr>
    <th colspan="4" align="left">Enter User Name and Password</th>
  </tr>
  <tr>
    <td> </td>
    <td colspan="2" align="left">Please type your user name and password.</td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td align="left">Site</td>
    <td align="left"><%=Request.ServerVariables("SERVER_NAME")%>  </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td align="left">User Name</td>
    <td align="left"><input name="UID" type="text" size="20"></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td align="left">Password</td>
    <td align="left"><input name="PWD" type="password" size="20"></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td colspan="2" align="center"><input type="submit" value="LOGON"></td>
    <td> </td>
  </tr>
</table>
</form>
</center></div>
</body>
</html>


And the code for Password-Protected Page is:-

<% @language="vbscript" %>

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

<html>
<head>
<title>Password Protected Page</title>
</head>

<body>
<h3>Password Protected Page	</h3>
<p> You are logged on as:
<% if len(Session("UID"))=0 Then
		Response.Write "<b> You are not logged on.</b>"
	else
		Response.Write "<b>" & Session("UID") & "</b>"
	end if
%>
</p>
<p>
	<a href="default.asp">Back to default</a>
</p>
</body>

</html>


And the Code for Logon.inc is

<%
  ' Do not cache this page.
  Response.CacheControl = "no-cache"

  ' Define the name of the users table.
  Const USERS_TABLE  = "tblUsers"
  ' Define the path to the logon page.
  Const LOGON_PAGE   = "/logon/logon.asp"
  ' Define the path to the logon database.
  Const MDB_URL      = "/logon/_private/logon.xls"

  ' Check to see whether you have a current user name.
  If Len(Session("UID")) = 0 Then
    ' Are you currently on the logon page?
    If LCase(LOGON_PAGE) <> LCase(Request.ServerVariables("URL")) Then
      ' If not, set a session variable for the page that made the request...
      Session("REFERRER") = Request.ServerVariables("URL")
      ' ...and redirect to the logon page.
      Response.Redirect LOGON_PAGE
    End If
  End If

  ' This function checks for a username/password combination.
  Function ComparePassword(UID,PWD)
    ' Define your variables.
    Dim strSQL, objCN, objRS
    ' Set up your SQL string.
    strSQL = "SELECT * FROM " & USERS_TABLE & " WHERE (UID='" & UID & "' AND PWD='" & PWD & "');"
    ' Create a database connection object.
    Set objCN = Server.CreateObject("ADODB.Connection")
    ' Open the database connection object.
    objCN.Open "driver={{Microsoft Excel Driver (*.xls)};DBQ=URL=" & Server.MapPath(MDB_URL) &";"
    ' Run the database query.
    Set objRS = objCN.Execute(strSQL)
    ' Set the status to true/false for the database lookup.
    ComparePassword = Not(objRS.EOF)
    ' Close your database objects.
    Set objRS = Nothing
    Set objCN = Nothing
  End Function
%>

(in reply to bobby)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 17:51:04   
The error is a general error HTTP 500 and other asp pages are working fine just these two are not working

The link is as follows:-

http://www.kpiusa.com/logon/Default.asp

This is working but the password protected page is not working

i already made changes that are required for excel database connectivity:)

(in reply to bobby)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 17:53:36   
By saying that "One password for each user" i mean to say whoever wants to download whitepapers should have login id like a registered member. everyone has to register seperately with new id

(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 17:58:18   
I get this error on logon.asp:
quote:


Active Server Pages error 'ASP 0128'

Missing File or Virtual attribute

/logon/logon.asp, line 3

The Include file name must be specified using either the File or Virtual attribute.


I don't see the include call in the code you posted for logon.asp... which would also leave your variables undefined on that page.

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to MariaK)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 18:06:32   
Sorry, i missed the two lines, while copying and pasting it

the logon .asp has the following code:-
<% @language="vbscript" %>

<!--#include virtual="/logon/_private/logon.inc"-->
<%
	'Was this page posted to?
	
	if UCase(Request.ServerVariables("HTTP_METHOD"))="POST"
	 Then
			'if so, check the username/password that was entered.
		if ComparedPassword(Request("UID"),Request("PWD"))
		 Then
		 		'if comparision was good, store the user name...
		 	Session("UID")=Request("UID")
		 		'......and redirect back to the original page.
		 	Response.Redirect Session("REFERRER")
		end if
	end if
%>

<html>

<head>
<title>Logon Page</title>
<style>
body  { font-family: arial, helvetica }
table { background-color: #cccccc; font-size: 9pt; padding: 3px }
td    { color: #000000; background-color: #cccccc; border-width: 0px }
th    { color: #ffffff; background-color: #0000cc; border-width: 0px }
</style>
</head>
<body bgcolor="#000000" text="#ffffff">
<h3 align="center"> </h3>
<div align="center"><center>
<form action="<%=LOGON_PAGE%>" method="POST">
<table border="2" cellpadding="2" cellspacing="2">
  <tr>
    <th colspan="4" align="left">Enter User Name and Password</th>
  </tr>
  <tr>
    <td> </td>
    <td colspan="2" align="left">Please type your user name and password.</td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td align="left">Site</td>
    <td align="left"><%=Request.ServerVariables("SERVER_NAME")%>  </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td align="left">User Name</td>
    <td align="left"><input name="UID" type="text" size="20"></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td align="left">Password</td>
    <td align="left"><input name="PWD" type="password" size="20"></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td colspan="2" align="center"><input type="submit" value="LOGON"></td>
    <td> </td>
  </tr>
</table>
</form>
</center></div>
</body>
</html>


(in reply to bobby)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 18:09:26   
quote:

Make sure that you have your browser set up to give you errors... rather than "Friendly HTTP error messages"


How can i set the browser to give proper errors??

(in reply to bobby)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 18:13:10   
I have set the browser to give proper errors

now i can see lots of error on the logon page

(in reply to bobby)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 18:16:55   
now its showing the following error
quote:


Microsoft VBScript runtime error '800a000d'

Type mismatch: 'ComparedPassword'

/logon/logon.asp, line 9



when i tried to open the password protected page
logon page is now working

(in reply to bobby)
BeTheBall

 

Posts: 6354
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/4/2004 22:09:36   
Here are a couple more things you may need to do. In Logon.inc, find this line:

objCN.Open "driver={{Microsoft Excel Driver (*.xls)};DBQ=URL=" & Server.MapPath(MDB_URL) &";

change it to:

objCN.Open "driver={Microsoft Excel Driver (*.xls)};DriverID=790;DBQ=" & Server.MapPath(MDB_URL) &";"

You have an extra "{" and you need to add the DriverID=790 part.

Second, you need to select the columns of your Excel sheet that contain the UID and PWD and name the range tblUsers. See if that gets the job done.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MariaK)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/5/2004 9:20:36   
Thanks Duane, I corrected those silly mistakes and finally i got another error

quote:


Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Excel Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x2d0 Thread 0x78c DBC 0x1c41edc Excel'.

/logon/_private/logon.inc, line 33



i am again posting the code for logon.inc

<%
  ' Do not cache this page.
  Response.CacheControl = "no-cache"

  ' Define the name of the users table.
  Const USERS_TABLE  = "tblUsers"
  ' Define the path to the logon page.
  Const LOGON_PAGE   = "/logon/logon.asp"
  ' Define the path to the logon database.
  Const MDB_URL      = "/logon/_private/logon.xls"

  ' Check to see whether you have a current user name.
  If Len(Session("UID")) = 0 Then
    ' Are you currently on the logon page?
    If LCase(LOGON_PAGE) <> LCase(Request.ServerVariables("URL")) Then
      ' If not, set a session variable for the page that made the request...
      Session("REFERRER") = Request.ServerVariables("URL")
      ' ...and redirect to the logon page.
      Response.Redirect LOGON_PAGE
    End If
  End If

  ' This function checks for a username/password combination.
Dim UID, PWD
  Function ComparePassword(UID,PWD)
    ' Define your variables.
    Dim strSQL, objCN, objRS
    ' Set up your SQL string.
    strSQL = "SELECT * FROM " & USERS_TABLE & " WHERE (UID='" & UID & "' AND PWD='" & PWD & "');"
    ' Create a database connection object.
    Set objCN = Server.CreateObject("ADODB.Connection")
    ' Open the database connection object.
    objCN.Open "DRIVER={Microsoft Excel Driver (*.xls)};DBQ=URL=/logon/_private/logon.xls;"
    ' Run the database query.
    Set objRS = objCN.Execute(strSQL)
    ' Set the status to true/false for the database lookup.
    ComparePassword = Not(objRS.EOF)
    ' Close your database objects.
    Set objRS = Nothing
    Set objCN = Nothing
  End Function
%>


I named the cells having the column heading UID and PWD as the table name i.e tblUsers.
This kind of thing once worked when i used the inbuilt mechanism of Frontpage to connect with database file instead of writting the code myself. But now :(, i don't know where i am going wrong or what should be done.

Isn't there any option for making Excel as the database file??

(in reply to BeTheBall)
BeTheBall

 

Posts: 6354
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/5/2004 9:28:37   
Replace this line:

objCN.Open "DRIVER={Microsoft Excel Driver (*.xls)};DBQ=URL=/logon/_private/logon.xls;"

with:

objCN.Open "driver={Microsoft Excel Driver (*.xls)};DriverID=790;DBQ=" & Server.MapPath(MDB_URL) &";"

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MariaK)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/5/2004 9:35:47   
Good its working but its not redirecting to the original page that was requested.
It is just accepting the values either its present in database or not and the logon page gets refreshed, i.e the logon page only appears with empty textboxes.:)

(in reply to BeTheBall)
BeTheBall

 

Posts: 6354
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/5/2004 9:43:40   
quote:

ORIGINAL: MariaK

Good its working but its not redirecting to the original page that was requested.
It is just accepting the values either its present in database or not and the logon page gets refreshed, i.e the logon page only appears with empty textboxes.:)


I think that is because the code is not finding a valid username/password combination. I just sent you an email with my email address so you can email me your Excel file for a closer look. I followed this tutorial last night at home and was able to get it working, so it is doable.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MariaK)
MariaK

 

Posts: 55
Joined: 6/21/2004
Status: offline

 
RE: Frontpage2003 and ASP database problem - 8/5/2004 10:19:59   
Thanks Duane for solving this problem. Lastly its working.
:)

So using ASP in Frontpage2003 Excel can be used as a database file

Thanks

(in reply to BeTheBall)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Frontpage2003 and ASP database problem
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts