asp:HyperLinkColumn

Discussion in 'ASP .Net Web Controls' started by TJS, Nov 29, 2003.

  1. TJS

    TJS Guest

    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>
    TJS, Nov 29, 2003
    #1
    1. Advertising

  2. TJS

    Sink Guest

    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

    >-----Original Message-----
    >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>
    >
    >
    >
    >.
    >
    Sink, Dec 1, 2003
    #2
    1. Advertising

  3. TJS

    TJS Guest

    thanks for responding.

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




    "Sink" <> wrote in message
    news:a28901c3b7df$a82e1c10$...
    > 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
    >
    > >-----Original Message-----
    > >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>
    > >
    > >
    > >
    > >.
    > >
    TJS, Dec 1, 2003
    #3
  4. TJS

    SInk Guest

    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



    >-----Original Message-----
    >thanks for responding.
    >
    >unfortunately, that would encrypt the value after it is

    displayed in the
    >form.
    >The encryption needs to prevent display at anytime.
    >
    >
    >
    >
    >"Sink" <> wrote in message
    >news:a28901c3b7df$a82e1c10$...
    >> 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
    >>
    >> >-----Original Message-----
    >> >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>
    >> >
    >> >
    >> >
    >> >.
    >> >

    >
    >
    >.
    >
    SInk, Dec 1, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maziar Aflatoun

    asp:HyperLinkColumn question

    Maziar Aflatoun, Nov 24, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    378
    Chris Jackson
    Nov 24, 2003
  2. Replies:
    0
    Views:
    417
  3. Maziar Aflatoun

    Apply css to asp:HyperLinkColumn

    Maziar Aflatoun, Jul 13, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,837
    Eliyahu Goldin
    Jul 14, 2004
  4. Developers@Enzigma
    Replies:
    0
    Views:
    1,137
    Developers@Enzigma
    Nov 10, 2004
  5. Mike C

    asp:hyperlinkcolumn Datagrid question...

    Mike C, Sep 9, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    115
    Mike C
    Sep 9, 2003
Loading...

Share This Page