asp.net mvc 4 - How can I encode URL parameters? -


i used method in class library , calling method controller. value passed not encoding. cant trace reason behind it.

class library

using system.web;  public static class commonlogic     {    public static string urlencode(string value)     {         return httputility.urlencode(value);     } } 

controller

var test =   commonlogic.urlencode("2") 

test value "2" , not encoded.

update:

i realized reason comments below. need not encoding encryption , decryption. don't want url parameters exposed plain text, instead want encrypted value , later in controller decrypt again before processing value. ideas on this?

"2" doesn't need urlencoded. it's not reserved symbol in urls. try testing string such "<".


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -