How to solve the Guid.NewGuid() problem
-
Hi all, I am struggling with a problem. Please some one suggest me to get out of that. I am working with a existing website developed by some other developer long back. I that he stores the images using name genearated by Guid.NewGuid(), the name of the picture in the folder is difference with this name in database. Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder. I dnt knw why he used Guid.NewGuid(), can any one please tell me what is the use and advantage of Guid.NewGuid() , also how to solve my issue. Thanks in advance
Know is Drop, Unknown is Ocean
-
Hi all, I am struggling with a problem. Please some one suggest me to get out of that. I am working with a existing website developed by some other developer long back. I that he stores the images using name genearated by Guid.NewGuid(), the name of the picture in the folder is difference with this name in database. Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder. I dnt knw why he used Guid.NewGuid(), can any one please tell me what is the use and advantage of Guid.NewGuid() , also how to solve my issue. Thanks in advance
Know is Drop, Unknown is Ocean
Exelioindia wrote:
Guid.NewGuid(),
It generates a unique GUID.
Exelioindia wrote:
Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder.
Then you can check the file's creation date and if it is more than 15 days, delete it.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Exelioindia wrote:
Guid.NewGuid(),
It generates a unique GUID.
Exelioindia wrote:
Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder.
Then you can check the file's creation date and if it is more than 15 days, delete it.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
Yor are correct, but along with that i am checking for some other conditions also in database Thanks for you reply
Know is Drop, Unknown is Ocean
-
Hi all, I am struggling with a problem. Please some one suggest me to get out of that. I am working with a existing website developed by some other developer long back. I that he stores the images using name genearated by Guid.NewGuid(), the name of the picture in the folder is difference with this name in database. Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder. I dnt knw why he used Guid.NewGuid(), can any one please tell me what is the use and advantage of Guid.NewGuid() , also how to solve my issue. Thanks in advance
Know is Drop, Unknown is Ocean
Exelioindia wrote:
I dnt knw why he used Guid.NewGuid(), can any one please tell me what is the use and advantage of Guid.NewGuid()
This is a common design to get round name collision issues. Basically, you can have two files called Document1.doc from different users - you can only store one of these in a directory, so you need to generate a unique name and associate this with the document. In other words, you rename the file from Document1.doc to your guid named file and you have a mapping in the database that shows the original filename and the new filename.
Deja View - the feeling that you've seen this post before.