Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 January 26th, 2004, 12:18 PM
Authorized User
 
Join Date: Sep 2003
Location: Pittsburgh, PA, USA.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validate Expiration date

I am trying to validate membership expiration date. (I am a beginner)

Although this part works fine:
<td class='headerTD'><strong>
 My Discussions | </strong>
   <% =f_name %>&nbsp;<% =l_name %> <% if session("dtlast") <> "" then response.write " | <i>your last visit was:</i> " %><% =session("dtlast") %>&nbsp;<% response.Write("| Your membership expires on ") %><% =dtExpire%>&nbsp;<% response.Write("| current date ") %><% =FormatDateTime(Now(),2) %>
</td>


This part is not working. Is there anything wrong with this code?

...
dtExpire = trim(request("dtExpire"))
    if dtExpire <= FormatDateTime(Now(),2) then
        response.Redirect("login_MEMBERSHIP.asp")
    end if
...
Reply With Quote
  #2 (permalink)  
Old January 26th, 2004, 12:29 PM
Authorized User
Points: 447, Level: 7
Points: 447, Level: 7 Points: 447, Level: 7 Points: 447, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Adrian, MI, USA.
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the only thing I can see is that

dtExpire = trim(request("dtExpire"))

is dealing with a string and your comparing it to a date with your if...then.

maybe try:

dtExpire = CDate(trim(request("dtExpire")))
Reply With Quote
  #3 (permalink)  
Old January 26th, 2004, 12:38 PM
Authorized User
 
Join Date: Sep 2003
Location: Pittsburgh, PA, USA.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I replaced the suggested line. Same problem. It let's me log in even though the membership expired.
Reply With Quote
  #4 (permalink)  
Old January 26th, 2004, 12:43 PM
Authorized User
Points: 447, Level: 7
Points: 447, Level: 7 Points: 447, Level: 7 Points: 447, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Adrian, MI, USA.
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try:

Response.Write(dtExpire & "<br />" & FormatDateTime(Now(),2))

and see if that sheds any light.
Reply With Quote
  #5 (permalink)  
Old January 26th, 2004, 12:53 PM
Authorized User
 
Join Date: Sep 2003
Location: Pittsburgh, PA, USA.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not sure what you mean...
Response.Write(dtExpire & "<br />" & FormatDateTime(Now(),2))
writes
1/22/04
1/26/04

 ...both dates are formated the same
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
How to validate date jijish ASP.NET 2.0 Professional 4 December 20th, 2007 07:17 AM
Validate date format is correct gayatrikeshkamat VB How-To 0 April 4th, 2006 07:48 AM
Validate Date sparc ASP.NET 1.0 and 1.1 Basics 1 September 20th, 2005 09:55 AM
validate date javascript lcsgeek Classic ASP Basics 3 October 3rd, 2003 04:07 PM
how to validate a date clientside lcsgeek Classic ASP Professional 2 October 3rd, 2003 03:25 AM



All times are GMT -4. The time now is 09:48 PM.


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