如何更改上次修改日期的Internet文件C#WPF [英] How do I change the last modified date internet file C# WPF

查看:75
本文介绍了如何更改上次修改日期的Internet文件C#WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我需要能够更改C#WPF应用程序中Web服务器上文件的上次修改日期。我真的看过,但没有办法这样做。如果这不可能,有没有办法写入web服务器上的简单txt文件或创建一个并上传它?



非常感谢!



我尝试过的事情:



我做过一些研究HttpWebResponse类没有用。

Hello, I need to be able to change the last modified date of a file that is on a web server in a C# WPF application. I truly have looked, but have found no way to do so. If this not possible, is there a way to either write to a simple txt file that is on a web server or create one and upload it?

Thanks so much!

What I have tried:

I have done some research on the HttpWebResponse class to no avail.

推荐答案

你在想错误的方向。如何 HttpWebResponse 可以与文件时间相关?



这只是服务器端的文件,因为可以从你的问题看。它与您的WPF客户端应用程序无关,没有任何关系。当然,您可以根据 HttpWebRequest 的内容来操作文件(我不知道为什么你甚至提到HTTP响应?它可能只在你回复回复时才有用) 好的,完成:-))。



你的服务器端是由.NET驱动的,所以你总是可以使用 System.IO .File 更改文件时间戳的方法:

文件类(System.IO) [ ^ ]。



顺便说一下,它不只是一次性价值;这个类使您可以访问三个点:创建,上次访问和上次写入时间;您还有本地时间与UTC时间选项。请阅读此MSDN帮助页面。



-SA
You are thinking in wrong direction. How HttpWebResponse can be related to file times?

It's just a file on the server side, as one can see from your question. It's not related to your WPF client application, nothing. Of course, you can manipulate the files based on the content of HttpWebRequest (I have no idea why you even mention HTTP response? it's probably only relevant when you are talking about replying back "Okay, done" :-)).

And your server side is driven by .NET, so you can always use System.IO.File methods to change the file time stamp:
File Class (System.IO)[^].

By the way, it's not just one time value; this class gives you access to three points: creation, last access and last write time; also you have local time vs UTC time options. Just read this MSDN help page.

—SA


这篇关于如何更改上次修改日期的Internet文件C#WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆