Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|VBA|

SharePoint

|Consultancy|Newsletter|Contact 
 SharePoint > ASP NET > Passing Data< Previous | Next > 

 

Sending Data to a Web Page

 
 

There are two mechanisms for sending data to a webpage.

 
 
  • URL Encoding

     
     
  • HTTP POST

     

     

    URL Encoding

     
     

    Parameters can be included in the actual URL string by appending them to the end of the URL.

     
     

    A querystring provides name-value pairs in the form of ?name1=value1&name2=value2 etc etc

     
     

    You must place a ? between the URL and the first parameter and then am & between each parameter.

     
     
    1
    http://www.bettersolutions.com?name=russell&location=london
       
     

    These parameters can be saved in the Favourites but the URL cannot be more than 2083 characters.

     
     

    This works great for simple alpha-numeric characters but it doesn't work when you want to pass special characters in the URL.

     
     

    The solution to this problem is to use the System.Web.HttpUtility.UrlEncode function.

     

     

    System.Web.HttpUtility.UrlEncode

     
     

    This method replaces problematic characters with URL-friendly equivalents.

     
     

    Alpha-numerics and the characters in the following table are not affected

     
     
    ASCII DecimalCharacterURL Encode
    95_ 
    45- 
    46. 
    39' 
    40( 
    41) 
    42* 
    33! 
     

     

    The following characters are affected

     
     

    The following table shows what UrlEncode translates:

     
     
    ASCII DecimalCharacterURL Encode
    32 +
    34"%22
    35#%23
    36$%24
    37%%25
    38&%26
    43+%2b
    44,%2c
    47/%2f
    58:%3a
    59;%3b
    60<%3c
    61=%3d
    62>%3e
    63?%3f
    64@%40
    91[%5b
    92\%5c
    93]%5d
    94^%5e
    96`%60
    123{%7b
    124|%7c
    125}%7d
    126~%7e
     

     

    HTTP POST

     
     

    Parameters are passed in the HTML body instead of the URL (or querystring).

     
     

    There is virtually no limit to the amount of data you can put in a POST field.

     




     Copyright © 2011 Better Solutions Limited. All Rights Reserved.< Previous | Top | Next >