 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 16th, 2007, 07:45 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Help with login page creation
Hi,
**FORGIVE ME AS THIS WAS POSTED IN ERROR ELSEWHERE**
I have been tasked into creating a login page for a website i am designing. I have never used asp before and therefore have little idea as to what i can do.
I have created a database in access and am using Macromedia Dreamweaver to create a page. I am lead to believe i want to create an asp page with a form that i then link to the database. This is where i get stuck - what happens next once the link is created etc? How can i test/view this as i know asp doesnt just render into IE or firefox.
I thank you in advance for your advice and information in aiding me with this.
Neil
|
|

February 16th, 2007, 08:02 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi
Though this is not an ASP section, still we can try to help you out, for your help, you can copy and past the below code in an asp page, I created this page years ago as a login for my application. Just change your access db path and the query to fetch username/password. (marked in red).
----------------------------------------------------------------------
<%
dim username, password
username=TRIM(Request("username"))
password=TRIM(Request("password"))
Dim Con, sql, rec
set Con = Server.CreateObject("ADODB.Connection")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
'Select the record matching the username.
sql = "SELECT * FROM tblusers WHERE UCase(username)=' "& UCase(username) & "' AND UCase(password)=' " & UCase(password) & " ' "
set rec=Con.execute(sql)
'If no match found, EOF is not true.
if NOT rec.EOF then
Response.Redirect("somepage.asp") 'Change to page redirect to after login
else
blankError="Invalid username." 'EOF is true, no match found.
end if
%>
<html>
<head>
<title>Login</title>
</head>
<body>
<form name="productForm" method="post" ID="Form1">
<center>
<table border="1" ID="Table1">
<tr>
<td colspan="2">
<%
if blankError<>"" then
Response.Write("<center>"&blankError&"</center>")
end if
%>
</td>
</tr>
<tr>
<td><Strong>Username:</Strong></td>
<td><input type="text" name="username" size="35" ID="Text1"></td>
</tr>
<tr>
<td><Strong>Password</Strong></td>
<td><input type="password" name="password" size="35" ID="Password1"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="loginButton" value="Login" ID="Submit1">
<input type="reset" name="reset" value="Clear" ID="Reset1"></td>
</tr>
</table>
</center>
</form>
</body>
</html>
----------------------------------------------------------------------
Regards
Mike
Fortune favours the brave, so don't regret on missed oppurtunities.
|
|

February 16th, 2007, 08:57 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Mike,
thanks for that, thats really appreciated. What i want to do is create a new ASP VBScript page and stick that code in there?
What happens, what do i do after that? do i have to create an HTML page calling the asp page? where do i load the asp page and how can i test?
Thanks again
Neil
|
|

February 16th, 2007, 09:54 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Well Neil
From your posts, what I could get is that you are basically a designer and have no idea of programming. I think you will need some practical help of a programmer at some stage. Anyways, I'll try to help you as much as possible.
To host asp pages, you will need IIS as webserver, wherein you will host your application. ASP pages can be created in plain notepad, and saved with .asp extension. I suggest that you copy and paste the content I posted, in a notepad file, save it as login.asp extension. Now create your application folder in the root folder of your machine, in (c:\inetput\wwwroot).
Now to test it, just enter this URL in your browser:
http://localhost/yourapplicationname/login.asp
Regards
Mike
Fortune favours the brave, so don't regret on missed oppurtunities.
|
|

February 16th, 2007, 10:02 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
To build upon Mikes statement a little bit more, if you are going to use Notepad that is inculuded with windows, when you go to save the file surround your file name with quotes in the Notepad save dialog so test.asp would be "test.asp". If you do not do this, notepad may save our file as test.asp.txt, which is undesireable.
Secondly, I don't suggest using plain old notepad, although that is where I started writing ASP years ago I would suggest downloading PSPad or Notepad+ (both are freeware) and work wonderfully for these types of things. (PSPad is a much better product IMHO)
hth
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
|
|

February 16th, 2007, 10:07 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Yep Parsons
I too agree with your suggestions, I forgot to mention that while saving the notepad file, don't forget to select "All Files" option from the "Save as Type" dropdown (another alternate to what parsons suggested).
Secondly, I suggested to use notepad coz Neil seems to be really new to programming, else he could easily use a lot of editors as you mentioned parsons (well my choice would be Interdev)
Regards
Mike
Fortune favours the brave, so don't regret on missed oppurtunities.
|
|

February 16th, 2007, 10:42 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Guys,
Thanks for all the advice, really is kind of you!
I am a newbie when it comes to programming, i can do HTML and some CSS but beyond that i dont seem to have a natural aptitude for it.
I can use notepad as suggested or i can use dreamweaver that i know and love.
I have installed IIS as required but when i ran it it couldn't find anything in the c:\windows\system32\inetsrv\ folder, the folder is there but empty. i downloaded and re-sinstalled IIS 6.0 but still nothing.
Any ideas?
Neil
|
|

February 16th, 2007, 10:45 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
what did u try to run, and what u couldn't find, please elaborate a bit, did u follow the steps that I suggested?
Regards
Mike
Fortune favours the brave, so don't regret on missed oppurtunities.
|
|

February 16th, 2007, 10:54 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
You run IIS's configuration manager by going to Start --> Settings --> Control Panel --> Administrative Tools --> Internet Information Services which opens up an MMC type console window that you can configure your website.
Also, I have never downloaded IIS, I have always installed it from windows CD and if you are on XP Pro you should be using IIS 5.1 as it is what comes with the XP Pro CD. (IIS 6.0 is what ships with Windows Server 2K3, 7.0 is Vista)
Also, if you are on XP HOME, I do not think you can install a webserver without some form of Hack.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
|
|

February 16th, 2007, 11:16 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
apologies - was my stupidity - i had home edition so i have done it on my work pc as i have just installed IIS and put the asp and the mdb files in the c:\inetpub\wwwroot
the next bit is somewhat confusing:
http://localhost/yourapplicationfolder/login.asp
- how would that look if, for instance, you where going to look at yours?
Many thanks once more
Neil
|
|
 |