?
Solved

Generating uniquie ID's for files that are produced by my Web APP?

Posted on 2008-10-16
4
Medium Priority
?
213 Views
Last Modified: 2013-12-17
HI I am developing a web app in C# / ASP.net with a SQL2005 database. I need to generate uniquie file id's & file names for files that are created, but don't want people to be able to guess a new file ID as they may see others data. What would be the best way to implement this type of thing?

Cheers

Baz
0
Comment
Question by:ipgbarry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
CuteBug earned 1000 total points
ID: 22737407
Use System.Guid to get unique IDs

System.Guid guid=System.Guid.NewGuid();
string filename = guid.ToString();
0
 

Expert Comment

by:JDEE8297
ID: 22737466
sounds like a good solution, but I had a similar situation and end users didn't understand what they meant unless you had some kind of a legend to go with it.

What I did in my system was the date time and id in the record in my database, the file itself was stored on the server, but I create a link to it so that when someone clicked on the link it would download the file with a meaningful name.

example

yyyymmdd_hhmmss_recordid_filenamewithoutextensioninit.ext where .ext corresponded to the to actual filetype of the file being downloaded.
0
 
LVL 16

Expert Comment

by:CuteBug
ID: 22737576
Thats a good solution too JDEE8297, but ipqbarry has this requirement
"don't want people to be able to guess a new file ID as they may see others data."

In such a case GUID can be useful.
0
 

Expert Comment

by:JDEE8297
ID: 22739419
true, but in my case the only people who have access to the files is the internal art people, the customer themselves don't have access to these file and if we ever did give them access to it. They still wouldn't be able to access them, because the actual name of the file that I send back to the user when the link is clicked, is not the actual name of the file on the server. Still the solution with the guid was a good one. :)
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question