473,414 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Comparing Date and Showing New or Old

In a forum I made in ASP Classic I had the following code.
-------------------------------
If Session("dtmLastVisit") = "" AND
Request.Cookies("DigiForum")("LastVisit") <> "" Then
Session("dtmLastVisit") = CDate(Request.Cookies("DigiForum")("LastVisit"))
Response.Cookies("DigiForum")("LastVisit") = CDbl(Now())
Response.Cookies("DigiForum").Expires = DateAdd("yyyy", 1, Now())
ElseIf Session("dtmLastVisit") = "" Then
Session("dtmLastVisit") = Now()
End If

If isNumeric(Request.Cookies("DigiForum")("LastVisit" )) Then
If CDate(Request.Cookies("DigiForum")("LastVisit")) < DateAdd("n", -5,
Now()) Then
Response.Cookies("DigiForum")("LastVisit") = CDbl(Now())
Response.Cookies("DigiForum").Expires = DateAdd("yyyy", 1, Now())
End If
Else
Response.Cookies("DigiForum")("LastVisit") = CDbl(Now())
Response.Cookies("DigiForum").Expires = DateAdd("yyyy", 1, Now())
End If
-------------------------------

This code made sure each time when a user revisited a page and there had
been a new post, a "new" would show itself.
The problem I have is making this code work in ASP .NET. I was wondering if
someone could give me an url on where
this topic is discussed in ASP .NET or maybe can help me convert this code
into VB for .NET.

Thx in advance,

Richard
Nov 18 '05 #1
2 1124
Hi Richard,

From your description and the code , most of them are Session and Cookie
manipulation. Generally, all the functions for Session and Cookie still
remains in ASP.NET and provide more convenient interfaces. Such as the
Buildin Session object and the Request.Cookies collection. You can
reference them in the MSDN's documentation. And since the Cookie need to
specify Expire date, in asp.net , we use the DateTime class rather than the
CDate in asp. Here are some tech articles on using cookie and session in
ASP.NET

http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vbtchaspnetcookies101.asp

http://msdn.microsoft.com/library/en...000.asp?frame=
true

also, some further resources on migrating from asp to asp.net:

#Converting ASP to ASP.NET
http://msdn.microsoft.com/library/en...sptoaspnet.asp
?frame=true

#Migrating to ASP.NET: Key Considerations
http://msdn.microsoft.com/library/en...issues.asp?fra
me=true

#ASP to ASP.NET Migration Assistant
http://msdn.microsoft.com/asp.net/us...igasst/default.
aspx

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 18 '05 #2
Hi Richard,

Did Steven's suggestion help on this issue? If you need further assistance,
please feel free to post here.

Regards,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: F | last post by:
Hi I have posted the question few days back about problem in inserting the dates in SQL server and thankful to them who replied. That was solved and this is a nice solution....
4
by: karunakar | last post by:
Hi All I was poplating Datagrid Datagrid has one of the column showing datetime field format iam showing DATE here not Necessary to populate the Time Frame Even my datebase column also...
3
by: Solitus | last post by:
Lets say i have 2 images, a.jpg and b.jpg Both are actually one same picture of a bear but have different filenames. is there anyway in .net that i can find out if the two pictures are actually...
5
by: Kermit Piper | last post by:
Hello, I am comparing two date values, one from a database and one that has been converted from a hard-coded string into an actual Date type. So far so good. The problem I'm having is that one...
12
by: colincolehour | last post by:
I am new to Python and am working on my first program. I am trying to compare a date I found on a website to todays date. The problem I have is the website only shows 3 letter month name and the...
2
by: Bob | last post by:
Hi, I have a wrong result when testing today against a date fetched from a table in excel. The value in excel is: 14/12/2006 (european format). When today is after that value in excel, the...
4
by: anagai | last post by:
I just want to check if a date entered in a textbox is equal to the current system date. I set the date object from the input field like this: dt1=new Date('10/01/2007'); the current system...
2
by: akshaycjoshi | last post by:
Hi, I am developing one application which requires me to compare date.The dataabse being MS access 2003. When i execute the query in c# it does not show any record ,the date although matches with...
1
by: Avi1 | last post by:
Hi, I got the code (from the internet)for comparing two files and showing the difference in contents.Now,I tried the same code for two files written in japanese language(kanji).If I save the two...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.