• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1506
  • Last Modified:

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);
    }




0
Sirdots
Asked:
Sirdots
  • 2
2 Solutions
 
molkuCommented:
httputility.urlencode just makes the string suitable for passing in a URL, it doesn't encrypt it.
I suppose the value of student would have to be encrypted in your data source, then when the next page would have to unencrypt it.
You could use SSL and https to send the entire request encrypted.
0
 
SirdotsAuthor Commented:
thanks molku. can you show me some code on how to do that?

0
 
molkuCommented:
Which option? S(ecure) S(ockets) L(ayer) is installed at the web server. It is a certificate and if you are using a hosting company it is usually an easy option to add to your service. You then somehow configure the pages you need encrypted to use https (I am no expert here...)

If you want to encrypt data in your database there are many options, there is a trade off between speed and encryption strength. Here is someone who knows more than me on that subject as well:
http://www.codeproject.com/KB/security/DotNetCrypto.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now