I try to Encrypt my query string through the following class :
The problem is:
My link is in a gridview , I don’t know how to use the encryption method through the eval expression in a correct way .
This what i have tried :
My .aspx :
<ItemTemplate>
<a id="btnShowPopup6" runat="server" class="thickbox" href='<%#"PageDetail.aspx?QueryStringModule.Encrypt(code="+Eval("t_code")+"&serial="+Eval("t_Serial")+"&year="+Eval("t_Year")+"&AR=1"+"&TBiframe=true&height=600&width=950)"%>'>
<asp:Image ID="Image43" runat="server" ToolTip="confirm" ImageUrl="Images/ok-blue.png"
Width="20" Height="20" />
</ItemTemplate>
Change your href= to the following and it should work.
By the way do not re-use your encryption key for anything other than this query string module. Unfortunately what the httpmodule does is creates a “cryptographic oracle” whereby you can supply any plaintext and it will return to you a valid cipher text encrypted with your key. So for example if you go to pagedetail.aspx?myname=moe it will encrypt myname=moe for me and give me a value that’s been encrypted with your key. If you use this value in other parts of your code for some type of verification or information hiding I can generate the encrypted strings at will.