Updates from July, 2009 Hide threads | Keyboard Shortcuts

  • Setting the Page Title in ASP NET from Server Code 

    jmaglasang 11:28 am on July 29, 2009 Permalink | Reply
    Tags: ASP NET

    Here is a quick n easy way to set the HTML Page Title from the server side, that most developers don’t know yet.

    VBNET:

    Me.Header.Title = "Title Here"

    C#:

    this.Header.Title = "Title Here";
     
  • Generating Unique Strings in NET 

    jmaglasang 12:25 pm on July 21, 2008 Permalink | Reply

    Approach 1:

    String s1 = Guid.NewGuid().ToString();
    String s2 = Guid.NewGuid().Tostring("N");
    String s3 = Guid.NewGuid().ToString("P");
    String s3 = Guid.NewGuid().ToString("D");
    [code]
    
    Approach 2:
    [code]
    String s1 = System.IO.Path.GetRandomeFileName();
    String s2 = System.IO.Path.ChangeExtension(System.IO.Path.GetRandomFileName(),null);
    

    Comparison or the 2 Approaches:
    1. Approach1 generates at least 32 characters (0-9 and a-f) letters only.
    Hint: larger size on the database, absolutely unique.
    2. Approach2 Generates at least 8 characters (0-9 and a-z) letters.
    Hint: Good for Captcha, less size on the database,  might have duplicates

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel