Click here to Skip to main content
15,916,945 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionImages not displaying in IIS7 [modified] Pin
Member 34269369-Mar-09 10:59
Member 34269369-Mar-09 10:59 
AnswerRe: Images not displaying in IIS7 Pin
Curtis Schlak.9-Mar-09 12:50
Curtis Schlak.9-Mar-09 12:50 
GeneralRe: Images not displaying in IIS7 Pin
Member 34269369-Mar-09 12:52
Member 34269369-Mar-09 12:52 
AnswerRe: Images not displaying in IIS7 Pin
N a v a n e e t h9-Mar-09 15:47
N a v a n e e t h9-Mar-09 15:47 
GeneralRe: Images not displaying in IIS7 Pin
Member 342693610-Mar-09 5:19
Member 342693610-Mar-09 5:19 
AnswerRe: Images not displaying in IIS7 Pin
Cybernate11-Mar-09 6:51
Cybernate11-Mar-09 6:51 
GeneralRecord Audio Pin
Paul R Morrison9-Mar-09 10:33
Paul R Morrison9-Mar-09 10:33 
GeneralRe: Record Audio Pin
Christian Graus9-Mar-09 11:08
protectorChristian Graus9-Mar-09 11:08 
NewsPage event order: Please critique this info Pin
Gregory Gadow9-Mar-09 7:04
Gregory Gadow9-Mar-09 7:04 
GeneralRe: Page event order: Please critique this info Pin
Anurag Gandhi9-Mar-09 19:50
professionalAnurag Gandhi9-Mar-09 19:50 
QuestionHttpException The file '/MyControls/Web/GUI/Controls/PageHead.ascx' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath) Pin
thomasa9-Mar-09 6:49
thomasa9-Mar-09 6:49 
AnswerRe: HttpException The file '/MyControls/Web/GUI/Controls/PageHead.ascx' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath) Pin
Christian Graus9-Mar-09 11:48
protectorChristian Graus9-Mar-09 11:48 
QuestionCreate random Number Pin
ptvce9-Mar-09 3:20
ptvce9-Mar-09 3:20 
AnswerRe: Create random Number Pin
Abhijit Jana9-Mar-09 3:28
professionalAbhijit Jana9-Mar-09 3:28 
GeneralRe: Create random Number Pin
scottgp9-Mar-09 5:09
professionalscottgp9-Mar-09 5:09 
GeneralRe: Create random Number Pin
Christian Graus9-Mar-09 11:09
protectorChristian Graus9-Mar-09 11:09 
AnswerRe: Create random Number Pin
N a v a n e e t h9-Mar-09 4:09
N a v a n e e t h9-Mar-09 4:09 
AnswerRe: Create random Number Pin
Jack Li9-Mar-09 4:59
Jack Li9-Mar-09 4:59 
GeneralRe: Create random Number Pin
N a v a n e e t h9-Mar-09 5:09
N a v a n e e t h9-Mar-09 5:09 
GeneralRe: Create random Number Pin
Abhishek Sur9-Mar-09 6:04
professionalAbhishek Sur9-Mar-09 6:04 
AnswerRe: Create random Number Pin
Perisic, Aleksandar9-Mar-09 7:55
Perisic, Aleksandar9-Mar-09 7:55 
You can take several approaches:

Make a list of max number of random numbers that you need and shuffle them, then go and insert one after another. A good random shuffle algorithm you can create in no time.

You could use a good hash function. There are plenty to choose. You need two keys, one is secret and somewhat random, and another is ID itself. You combine them and get a random number using the hash function. (I can give you an example of very simple and fast one if you like.)

Another is to create a circular random function which calculates a random number from the previous random value. You keep only the last entry. You take care that the cycle size is exactly what you need.

You use normal random number and check if that one is used in the database, and keep searching for the one that is not.

You can use a simple random number and attach to it your ID so that the size of both is 10 digit. For example you know you will not need more than 9999 id's. Good. Take six digit random number and concatenate to it 4 digit ID. This is not a completely random number but it is as strong as six digit random number.

You can use a matrix

  0123456789
0
1
2
3
4
5
6
7
8
9

and then use random generator mod 10 (0-9 digit at random) (or in general mod matrix size). Now ,if you would get these numbers 4, 5, 7, 0 you mark (4,5) (5,7) (7,0) and keep on until you get your first ten-digit number. For the next ten-digit number you keep on marking but you count how many entries were previously already marked. If you find for a 10 digit number that its all 9 entries were marked you reject that number. This way you get a smaller number of unique random numbers, but the matrix can always be larger (100x100...), of course.

Keep in mind what security level you need.

And do not use GUID, it is never a random number on one computer.

modified on Monday, March 9, 2009 2:02 PM

GeneralRe: Create random Number Pin
Yusuf9-Mar-09 8:20
Yusuf9-Mar-09 8:20 
GeneralRe: Create random Number [modified] Pin
Perisic, Aleksandar9-Mar-09 9:05
Perisic, Aleksandar9-Mar-09 9:05 
GeneralRe: Create random Number Pin
Yusuf9-Mar-09 10:54
Yusuf9-Mar-09 10:54 
GeneralRe: Create random Number Pin
Perisic, Aleksandar9-Mar-09 11:44
Perisic, Aleksandar9-Mar-09 11:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.