Link to home
Start Free TrialLog in
Avatar of Sirdots
Sirdots

asked on

Hiding/encrypting a querystring variable

i have a templatefield and  will like to hide the value of the student variable
when passing this to the next page. I decided to use the httputility.urlencode
to make this value non meaningful but this is not working for me. I am still
getting the same value. How can i do this?

asp:TemplateField HeaderText="picture">            
                <ItemTemplate>  
                  <asp:HyperLink ID="Label1" runat="server" Text='<%# Bind("picture") %>' NavigateUrl=<%#"javascript:my_window=window.open('displayImage.aspx?student=" + UrlFullEncode(DataBinder.Eval(Container.DataItem,"student").ToString()) + "','my_window','width=300,height=300');my_window.focus()" %>/>
                </ItemTemplate>
            </asp:TemplateField>


private const string _strApostropheEncoding = "%27";
    public static string UrlFullEncode(string strUrl)
    {
        if (strUrl == null)
            return "";
        strUrl = HttpUtility.UrlEncode(strUrl);
        return strUrl.Replace("'", _strApostropheEncoding);
    }




SOLUTION
Avatar of molku
molku

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sirdots
Sirdots

ASKER

thanks molku. can you show me some code on how to do that?

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial