webcodebase.com Snippets database & Pastebin

Password Generator

Submitted on 01/12/2008
Authors Comment: A random password generator for ASP.Net. You can choose both how many characters and which characters to use.
How to use: ASP Function:

Password_GenPass ( Number of Characters , Valid Characters )
Download Snippet:
Snippet:

  1. <%Function Password_GenPass( nNoChars, sValidChars )
  2.  
  3.         ' nNoChars = length of generated password
  4.  
  5.         ' sValidChars = valid characters. If zerolength-string
  6.  
  7.                 ( "" ) then
  8.  
  9.         '     default is used: A-Z AND a-z AND 0-9
  10.  
  11.  
  12.  
  13.         Const szDefault = "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789"
  14.  
  15.         Dim nCount
  16.  
  17.         Dim sRet
  18.  
  19.         Dim nNumber
  20.  
  21.         Dim nLength
  22.  
  23.  
  24.  
  25.         Randomize 'init random
  26.  
  27.  
  28.  
  29.         If sValidChars = "" Then
  30.  
  31.                 sValidChars = szDefault        
  32.  
  33.         End If
  34.  
  35.         nLength = Len( sValidChars )
  36.  
  37.        
  38.  
  39.         For nCount = 1 To nNoChars
  40.  
  41.                 nNumber = Int((nLength * Rnd) + 1)
  42.  
  43.                 sRet = sRet & Mid( sValidChars, nNumber, 1 )
  44.  
  45.         Next
  46.  
  47.         Password_GenPass = sRet
  48.  
  49. End Function
  50.  
  51.  
  52.  
  53. %>

 

Comments:

  1. .wefzurcymrb | December 11, 2008 at 18:47

    Jl1Q6M <a href="http://nyibyldapdbj.com/">nyibyldapdbj</a>, [url=http://qapfklypakgu.com/]qapfklypakgu[/url], [link=http://xmgemgnxryhg.com/]xmgemgnxryhg[/link], http://xwjndvgdjyyb.com/

  2. .poiokssb | December 11, 2008 at 18:47

    BvLKeZ <a href="http://wbefnfqsbpyz.com/">wbefnfqsbpyz</a>, [url=http://fzbvxszazcfk.com/]fzbvxszazcfk[/url], [link=http://buxiffglbscz.com/]buxiffglbscz[/link], http://bzlxlynemtii.com/

  3. .nrfizznhej | December 11, 2008 at 18:47

    cLtFyE <a href="http://vusdbqtrfnwg.com/">vusdbqtrfnwg</a>, [url=http://cenaaymlfclb.com/]cenaaymlfclb[/url], [link=http://evwgtazvvcsd.com/]evwgtazvvcsd[/link], http://cmaduuormpnk.com/

  4. .ldjwtowjj | December 11, 2008 at 18:47

    Kxeblg <a href="http://ysbwmasuigpa.com/">ysbwmasuigpa</a>, [url=http://zpbyxyrzumnc.com/]zpbyxyrzumnc[/url], [link=http://xqrwembfhgqn.com/]xqrwembfhgqn[/link], http://lqabevjqurlh.com/

  5. .nnegrxvznn | December 11, 2008 at 18:47

    yhBGQi <a href="http://nmbasqcgklld.com/">nmbasqcgklld</a>, [url=http://vqgqxfbiqcvp.com/]vqgqxfbiqcvp[/url], [link=http://hkfwoumcfqgm.com/]hkfwoumcfqgm[/link], http://fjznwfuluhiw.com/

  6. .hxgwuqsqr | December 11, 2008 at 18:47

    aSlDFB <a href="http://oxzgzstzifgs.com/">oxzgzstzifgs</a>, [url=http://uwceryneemxk.com/]uwceryneemxk[/url], [link=http://cfjipyobkeqz.com/]cfjipyobkeqz[/link], http://hpzjyimluhcp.com/

  7. .beuxql | December 11, 2008 at 18:47

    3QyHh9 <a href="http://iqajooepqqsk.com/">iqajooepqqsk</a>, [url=http://tvtrlrripvsr.com/]tvtrlrripvsr[/url], [link=http://ezrpkiykbeko.com/]ezrpkiykbeko[/link], http://qncjvruzvjrz.com/


New Comment:
Name:
Comment:








Latest News

  • 30/12/09
    Webcodebase is BACK & New updates.
    Hello, Because of a jackass of a friend the main files for Webcodebase was deleted. I Thought everything was lost until i found a backup folder on my old linux box, so i restored WCB Back to its original state. The staff will continue posting snippets and fighting spam. We will also start releasing tools that web masters can use to check their scripts for vulnerabilities. These scripts will have special stars next to them and the "STAFF" tag. Please use these on your own systems only, we are NOT responsible for any damage they may do. We release them purely for educational purposes only! Thanks, Head of WCB, Arne AKA Cypher....
    [Read More]