Skip Navigation Links
Level Orange > Categories
Encode URLs and Query Strings

There are many times that you will want to pass query parameters in a query string. The best practice approach to do this is to make sure that you URL Encode them so that any special characters are safely translated. You can decode them on the receiving side.

Encoding Example:

string PageWithQueryString = @"Bad & {Worse}";

PageWithQueryString = @"NewPage.aspx?ID=" + Server.UrlEncode(PageWithQueryString);

Response.Redirect(PageWithQueryString, false);

 

Decoding Example:

string QryString = Server.UrlDecode(Request.QueryString["ID"].ToString());

 

Table of Characters:

ASCII Value

URL-encode

ASCII Value

URL-encode

ASCII Value

URL-encode

æ

%00

0

%30

`

%60

  

%01

1

%31

a

%61

  

%02

2

%32

b

%62

  

%03

3

%33

c

%63

  

%04

4

%34

d

%64

  

%05

5

%35

e

%65

  

%06

6

%36

f

%66

  

%07

7

%37

g

%67

backspace

%08

8

%38

h

%68

tab

%09

9

%39

i

%69

linefeed

%0a

:

%3a

j

%6a

  

%0b

;

%3b

k

%6b

  

%0c

<

%3c

l

%6c

c return

%0d

=

%3d

m

%6d

  

%0e

>

%3e

n

%6e

  

%0f

?

%3f

o

%6f

  

%10

@

%40

p

%70

  

%11

A

%41

q

%71

  

%12

B

%42

r

%72

  

%13

C

%43

s

%73

  

%14

D

%44

t

%74

  

%15

E

%45

u

%75

  

%16

F

%46

v

%76

  

%17

G

%47

w

%77

  

%18

H

%48

x

%78

  

%19

I

%49

y

%79

  

%1a

J

%4a

z

%7a

  

%1b

K

%4b

{

%7b

  

%1c

L

%4c

|

%7c

  

%1d

M

%4d

}

%7d

  

%1e

N

%4e

~

%7e

  

%1f

O

%4f

  

%7f

space

%20

P

%50

%80

!

%21

Q

%51

  

%81

"

%22

R

%52

%82

#

%23

S

%53

ƒ

%83

$

%24

T

%54

"

%84

%

%25

U

%55

%85

&

%26

V

%56

%86

'

%27

W

%57

%87

(

%28

X

%58

ˆ

%88

)

%29

Y

%59

%89

*

%2a

Z

%5a

Š

%8a

+

%2b

[

%5b

%8b

,

%2c

\

%5c

Œ

%8c

-

%2d

]

%5d

  

%8d

.

%2e

^

%5e

Ž

%8e

/

%2f

_

%5f

  

%8f

Finding Assembly Information

Once again, in an attempt to segment information to prevent information overload, this is a simple one. In MOSS development, you will many times have to reference assemblies by class name and assembly name along with the public key token. To accomplish this I use a tool called .NET reflector which can be located here.

If you drag your assembly on the user interface of the tool, you can click on it and see the assembly information as such:

If you drill down to the actual class, you can see the class information as such:

Promised it would be short but invaluable if this is the first time you've seen the tool.

GAC’ing an assembly

Probably not a blog-able subject but wanted something to link to so here goes.

  1. First thing to do here is strong-name your assembly. Simply go to properties on the project and signing section.

  2. Build your assembly by pressing F7 or however you wish
  3. From here you can use gacutil, add gacutil to a post-build event or simply navigate to dll and drop it into "c:\windows\assembly"
Generating a new GUID

Inevitably in MOSS if you are doing custom development there will come a point where you will have to generate new GUIDs for your features, lists, fields and whatever else. There is a quick and easy way of doing this from Visual Studio.

Simply open Visual Studio and go to Tools à Create GUID

 

Choose Registry Format and then Copy. Done and Done. Know that certain GUIDs in MOSS will complain if you have curly braces {} and some will not.

If you are more of a command-line person you can get to the same screen by typing:

guidgen

 

in the Visual Studio Command Window