Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 11th, 2005, 03:05 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP logon page

Hi guys! I need some help on this logon page I found in Microsoft knowledge base. I need the logon page direct the user to a page called tech.asp resided in the same folder as the logon page. However, the current one just points to page on Microsoft website, and even the user name and password show up in the URL! I know it must have something to do with the <form action> code. Please help!

Cinderella

<html>
<head>
<title>Logon Form</title>
<%
Username="Administrator"
Password="Admin"
Validated = "OK"
if Strcomp(Request.Form("User"),Username,1)=0 AND Request.Form("password") = Password then
'Set the validation cookie and redirect the user to the original page.
    Response.Cookies("ValidUser") = Validated
    'Check where the users are coming from within the application.
    If (Request.QueryString("from")<>"") then
    Response.Redirect Request.QueryString("from")
    else
    'If the first page that the user accessed is the Logon page,
        'direct them to the default page.
          Response.Redirect "MyPage.asp"
    End if
Else
' Only present the failure message if the user typed in something.
    If Request.Form("User") <> "" then
        Response.Write "<h3>Authorization Failed.</h3>" & "<br>" & _
        "Please try again.<br>#xa0;<br>"
    End if
End if
%>
</head>
<body bgcolor="#FFFFFF">
<FORM ACTION=http://support-preview.partners.extranet.microsoft.com "Logon.asp?"&Request.QueryString%><input type="hidden" name="fp" value="2"><input type="hidden" name="scid" value="<%Response.Write"> method="post">
<h3>Logon Page for MyPage.asp</h3>
<p>
Username:
<INPUT TYPE="text" NAME="User" VALUE='' size="20"></INPUT>
Password:
<INPUT TYPE="password" NAME="password" VALUE='' size="20"></INPUT>
<INPUT TYPE="submit" VALUE="Logon"></INPUT>
</FORM>
</body>
</html>


Reply With Quote
  #2 (permalink)  
Old February 11th, 2005, 04:59 PM
Friend of Wrox
 
Join Date: Jan 2004
Location: , , USA.
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try this

<html>
<head>
<title>Logon Form</title>
<%
IF Request.QueryString("strAction") = "Posted" Then
Username="Administrator"
Password="Admin"
Validated = "OK"
if Strcomp(Request.Form("User"),Username,1)=0 AND Request.Form("password") = Password then

'Set the validation cookie and redirect the user to the original page.
    Response.Cookies("ValidUser") = Validated
    Response.Redirect "tech.asp"

Else
' Only present the failure message if the user typed in something.
    If Request.Form("User") <> "" then
        Response.Write "<h3>Authorization Failed.</h3>" & "<br>" & _
        "Please try again.<br><br>"
    End if
End if
End IF
%>
</head>
<body bgcolor="#FFFFFF">
<FORM ACTION="Logon.asp?strAction=Posted" method="post">
<h3>Logon Page for MyPage.asp</h3>
<p>
Username:
<INPUT TYPE="text" NAME="User" VALUE='' size="20"></INPUT>
Password:
<INPUT TYPE="password" NAME="password" VALUE='' size="20"></INPUT>
<INPUT TYPE="submit" VALUE="Logon"></INPUT>
</FORM>
</body>
</html>
Reply With Quote
  #3 (permalink)  
Old February 12th, 2005, 08:44 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

<form method="get"> = Values are sent as QueryStrings
<form method="post"> = Values are sent as request.form("elementName")

Wind is your friend
Matt
Reply With Quote
  #4 (permalink)  
Old February 14th, 2005, 12:19 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi guys,

I really appreciate all your replies. I modified my script as shahchi1 suggested. However, I got the following error:
Response object error 'ASP 0156 : 80004005'

Header Error

/technology/tech_only/Logon.asp, line 9

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.

It seems that this is the line causing the problem:
the Response.Cookies("ValidUser") = Validated

However, it is written within <head> part before page content starts. Any suggestions?

Thanks!

Cinderella

Reply With Quote
  #5 (permalink)  
Old February 14th, 2005, 01:50 PM
Friend of Wrox
 
Join Date: Jan 2004
Location: , , USA.
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this code not the one I have posted earlier

<%
IF Request.QueryString("strAction") = "Posted" Then
Username="Administrator"
Password="Admin"
Validated = "OK"
if Strcomp(Request.Form("User"),Username,1)=0 AND Request.Form("password") = Password then

'Set the validation cookie and redirect the user to the original page.
    Response.Cookies("ValidUser") = Validated
    Response.Redirect "tech.asp"

Else
' Only present the failure message if the user typed in something.
    If Request.Form("User") <> "" then
        Response.Write "<h3>Authorization Failed.</h3>" & "<br>" & _
        "Please try again.<br><br>"
    End if
End if
End IF
%>

<html>
<head>
<title>Logon Form</title>
</head>
<body bgcolor="#FFFFFF">
<FORM ACTION="Logon.asp?strAction=Posted" method="post">
<h3>Logon Page for MyPage.asp</h3>
<p>
Username:
<INPUT TYPE="text" NAME="User" VALUE='' size="20"></INPUT>
Password:
<INPUT TYPE="password" NAME="password" VALUE='' size="20"></INPUT>
<INPUT TYPE="submit" VALUE="Logon"></INPUT>
</FORM>
</body>
</html>

Reply With Quote
  #6 (permalink)  
Old February 14th, 2005, 02:37 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Shahchi1,

It worked! Many Thanks! You were a big help!

Cinderella

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need an ASP script for Member reg. & Logon CSUjr Classic ASP Basics 1 October 16th, 2006 08:01 AM
ASP Logon Page to Microsoft SharePoint Server mjoudia Classic ASP Professional 1 January 4th, 2006 12:06 PM
logon.asp and validate .asp problems p2ptolu Classic ASP Basics 1 February 17th, 2005 12:33 AM
"Logon failed" error in ASP.NET Dmitriy Pro VB 6 0 August 18th, 2004 12:23 PM
Logon Fail in Crtystal Report with ASP.Net charles Crystal Reports 0 October 1st, 2003 10:01 PM



All times are GMT -4. The time now is 02:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.