Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do I get the modified date of an XML file on a server(with http link)


What I have tried:

File.GetLastWriteTime(httpUrl); throws exception : <pre>URI formats are not supported.
Posted
Updated 6-Feb-23 2:45am
Comments
Andre Oosthuizen 6-Feb-23 6:11am    
Show us some more code relating to your GetLasrWriteTime function call, how did you referenced the httpUrl?

FIle operations only work on local drives and network shares.
To access file information directly from your server via a URL, you would need to use FTP instead - which means the remote site would need to be configured for FTP access and you would need the correct login info for that specific setup.

Think about it: if you could access files on any server at any time just with the URL then all sites would be vulnerable to malicious attacks on codebase or data.
 
Share this answer
 
You don't. Like Griff said, File operations only work with actual drives and shares, not web addresses.

You could use FTP, or if you have control of the code running on the web server, implement a method that could return the LastModified datetime in a Web API call.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900