Last post Mar 19, 2016 03:54 PM by bruce (sqlwork.com)
Mar 19, 2016 03:54 AM|klbaiju|LINK
in my application iam using hiddenfields for storing values.
during testing the application ,i found that every one can change the value of hiddenfield in browser and crack the application.
so iam thinking of hiddenfield with varibles using jquery.
currently iam setting the value of hiddenfield using c# like this
in load event
hddate.Value = newyear;
hfdate.Value = nyear;
hdfval.Value = fval;
here hddate,hfdate and hdfval are hiddenfields .
my requirement is declare varible using jquery.
how to set value to these varible in c# file like above
Mar 19, 2016 04:46 AM|Nataraj Gandhi Arunachalam|LINK
We need to first find out why the hidden fields are used in the first place before we switch to using variables. while your form is posted back to server, the hidden fields also get posted.
So if your backend code depends on the hidden fields values that gets posted back, then just changing the hidden fields to jquery variables may create some defects.
However, if you are using Ajax to post only some selected values in the form, then of course you can store the values in variables and then use it wherever you need. But a user who can change the hidden field value should be even able to change the values
of the variables if he wants.
So, basically, we can take the appropriate approach based on your application functionality.
Mar 19, 2016 11:58 AM|ssramvinay.83|LINK
I will assume you are using an .net application and having .aspx & C# page.
In test.aspx,you are having these following hidden values
<input type="hidden" id="test1"/>
<input type="hidden" id="test2"/>
<input type="hidden" id="test3"/>
<input type="hidden" id="test4"/>
In jquery, assign any values as you wish inside the val():For ex: i have passed different strings
So,Test1 value set as 'first value'
So,Test2 value set as 'second value'
So,Test3 value set as 'third value'
So,Test4 value set as 'fourth value'
Mar 19, 2016 03:54 PM|bruce (sqlwork.com)|LINK