locked
Is there a C# code that gives me a URL webpage creation and modified date? RRS feed

  • Question

  • User-1392235324 posted

    Is there a C# code that gives me a URL webpage creation and modified date?

    Thursday, May 19, 2016 5:29 AM

Answers

  • User-1636183269 posted

    In stateless application, you will not get any extra information.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 19, 2016 6:31 AM
  • User-821857111 posted

    You can get a file's creation and modification dates using C#: 

    https://msdn.microsoft.com/en-us/library/system.io.file.getcreationtime(v=vs.110).aspx

    https://msdn.microsoft.com/en-us/library/system.io.file.getlastwritetime(v=vs.110).aspx

    However, a URL is not a file. It's a resource, which may sometimes be based on the content of a file, but not always. And since the data returned by most URLs is constructed dynamically on demand, a created and modified date has no meaning.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 19, 2016 8:06 AM
  • User753101303 posted

    Hi,

    Not really. If you asked for a deletion before a publish you would likely get a wrong file creation date for example depending on the publishing method. Some url may not match any file etc...

    IMO it would be best to explain your exact goal (I'm not even sure to get if you want this for your own site or if you want to fetch this information from some 3rd party site etc...). Usually it is useless for page and this is rather the data shown by the page which have an update date (such as a publication date for a blog post etc...)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 19, 2016 8:12 AM

All replies

  • User-1636183269 posted

    In stateless application, you will not get any extra information.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 19, 2016 6:31 AM
  • User-821857111 posted

    You can get a file's creation and modification dates using C#: 

    https://msdn.microsoft.com/en-us/library/system.io.file.getcreationtime(v=vs.110).aspx

    https://msdn.microsoft.com/en-us/library/system.io.file.getlastwritetime(v=vs.110).aspx

    However, a URL is not a file. It's a resource, which may sometimes be based on the content of a file, but not always. And since the data returned by most URLs is constructed dynamically on demand, a created and modified date has no meaning.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 19, 2016 8:06 AM
  • User753101303 posted

    Hi,

    Not really. If you asked for a deletion before a publish you would likely get a wrong file creation date for example depending on the publishing method. Some url may not match any file etc...

    IMO it would be best to explain your exact goal (I'm not even sure to get if you want this for your own site or if you want to fetch this information from some 3rd party site etc...). Usually it is useless for page and this is rather the data shown by the page which have an update date (such as a publication date for a blog post etc...)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 19, 2016 8:12 AM