asp:HyperLinkColumn

T

TJS

how can I encrypt the querystring values for a HyperLinkColumn ?

in example below I would like to encrypt value for field1
======================================================
<asp:HyperLinkColumn Text="View" DataNavigateUrlField="field1"
DataNavigateUrlFormatString="page.aspx?idx={0}"></asp:HyperLinkColumn>
 
S

Sink

One way of doing this is to convert from a hyperlink to
a button column, they appear the same. Add an
OnItemCommand handler and in the OnItemCommand handler,
encrypt your id using whatever method you choose and the
call Response.Redirect("....?id=" + EncrytptedValue");
You have to extract the id from the e parameter wen the
OnItemCommand is called.
If you are using paging, make sure you add a check for the
pager in your OnItemCommand handler (the pager is just
another ListItem)or paging will no longer work, especially
as you are changing pages.
On your receiving page side, you decrypt your id and
forward you go.
The OnItemCommand is defined within the datagrid definition
and the check line for the OnItemCommand Handler

if(e.Item.ItemType == ListItemType.Pager)
return;

Hope this helps,
Sink
 
T

TJS

thanks for responding.

unfortunately, that would encrypt the value after it is displayed in the
form.
The encryption needs to prevent display at anytime.
 
S

SInk

If you keep the actual key in a non-visible field, a bound
column with Visible=False, display some other field,
your requirements would be met.
You would extract the key field from the hidden field
in the handler.

Alternatively, though if the field is hidden, you could
encrypt the key in a seperate db field, using say SHA, and
then use the encrypted field in your hidden field and
save the decrypt on the second page.

Regards
Sink
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top