I have an application in windows mobile 6.after deploying the application,it will create a CAB file. I Want to Upload this CAB file To Server using File Upload Control From Asp.Net Web Form..
While Uploading I want to check the CAB file is already Uploaded Before by checking its version number[Unique Generated by .NET while Deploying] rather than Just its name.
How to get this unique version from C# ???
Please help me on this.....
Thanks in Advance
Why not just use an MD5 hash of the file itself? That's going to give you a pretty good uniqueness.
public string GetFileHash(string fileName)
{
using (var stream = File.Open(fileName, FileMode.Open))
{
var md5 = new MD5CryptoServiceProvider();
var hash = md5.ComputeHash(stream);
var sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("x2"));
}
return sb.ToString();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.