Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 14th, 2004, 02:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default FileInfo object

Hello,

I'm using the FileInfo object to get the last write time of the file to write on the web page. However, the date that I'm getting is 12/31/1600! My code is below:
Code:
Dim objInfo As New FileInfo(Request.Path)
Label1.Text = objInfo.LastWriteTime.ToShortDateString()
This code is defined in a class that all of the web pages inherit from. Any idea why it outputs the date as 12/31/1600?

Thanks,

Brian Mains
__________________
Brian
  #2 (permalink)  
Old January 14th, 2004, 05:38 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Brian,

   The Request.Path will return something like /<folder_name>/file_name.aspx. The date being returned seems do be a dummy date returned in the event of an error, which the above code causes.

You need to put the pathe in front of what is returned.. for example

Dim objInfo As New FileInfo("c:/inetpub/wwwroot/<folder_name>" + Request.Path)

or you have to hard code the full path

c:\inetpub\wwwroot\folder\file ....

I tried both and they work.

Jim

  #3 (permalink)  
Old January 14th, 2004, 05:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I'm trying to do it dynamically, because the class is being imported into every ASP.NET page (page inheritance), and so I don't want to hard code one file's path because that would be an error.

Any ideas?

Thanks.
  #4 (permalink)  
Old January 14th, 2004, 09:50 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Use Server.MapPath() to get the full local path of a relative url.

Peter
------------------------------------------------------
Work smarter, not harder.
 


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
FileInfo Arrya Contains Property dpkbahuguna ASP.NET 3.5 Basics 5 November 11th, 2008 09:23 AM
FileInfo Class Path Problem kwilliams VB.NET 6 April 18th, 2007 11:14 AM
Serializing Object Graph - Assigning Object to Jag venkat.kl C# 0 August 28th, 2006 10:39 AM
Combining *.csv files sing FileInfo class mhite05 C# 0 October 25th, 2005 09:53 AM
create a Line object ,Box object in CR at Runtime? thanhnt Pro VB 6 1 May 16th, 2005 06:51 AM



All times are GMT -4. The time now is 07:35 PM.


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