PDA

View Full Version : Encode & ecrypt url



hieu79vn
16 Aug 2012, 11:54 PM
Hi

I have an Ext.Ajax.Request to server to get update data like this

Ext.Ajax.request({
url: '<%=WwwRoot%>/page.aspx/en/col/abc?Blog=' + blogValue ,
method: 'GET',
scope: this,
success: function (response) {
},
failure: function (result, request) {
Ext.Msg.alert('Failed', request.result ? request.result.message : 'Cannot send ');
}
});
blogValue is an HTML text get from htmleditor so it can contains font, format tag. My server application is written in C# and it will check security for all the request url to server. If the url contains " <, /, &", it will be considered as dangerous and be refused. Therefore, I would like to ecode my blog value to base64 (all in character) and will decode it in server to get params.
Could you please tell me how to do that?

Another question. Is there any way to encrypt the URL or parameter in Ext.Ajax.Request? With the Inspect Element function in Chrome, a normal user can see my code above with the url and name of params => they can modify the url to hack my server.

Thank you

sword-it
17 Aug 2012, 12:39 AM
Hi hieu,

Try this -


Ext.util.format.htmlEncode(blogValue);


see also http://docs.sencha.com/ext-js/4-1/#!/api/Ext.util.Format-method-htmlEncode

y (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.util.Format-method-htmlEncode)ou can test here http://www.string-functions.com/htmlencode.aspx

hieu79vn
19 Aug 2012, 10:23 PM
Thank you Sword-it