Last post Jul 02, 2019 03:37 AM by Yongqing Yu
Jul 01, 2019 04:24 PM|jsshivalik|LINK
I am sending parameter thru Url . I want it should not be visible or in encrypted form
Jul 01, 2019 05:04 PM|PatriceSc|LINK
You could try https://www.aspsnippets.com/Articles/Encrypt-and-Decrypt-QueryString-Parameter-Values-in-ASPNet-using-C-and-VBNet.aspx but
IMHO if you need to encrypt this value it means something is wrong.
For example if you have ?id=10 and using ?id=11 is enough to show a line another user is not supposed to be able to see it means rather that in addition to using the pk you should check as well if the current user is supposed to be able to see this row.
Depending on how you'll handle encryption, a screenshot where you see the encrypted value could still allow to access a row you are not supposed to see. If done correctly even seeing id=11 should allow access to a user which is not supposed to be able to
Jul 02, 2019 03:37 AM|Yongqing Yu|LINK
According to your description, in addition to the encrypted information you mentioned, if you want to transfer information between pages and can't let users see specific information, you also have many other options, such as session, cookie, cache, etc.
Through these functions,you don't need to send parameter through url.
You can see their specific usage through this link : https://www.codeguru.com/columns/dotnet/passing-data-between-pages-in-asp.net.htm
I have made an example to pass name from one page to another with session, you could refer to the following code:
protected void Button1_Click(object sender, EventArgs e)
Session["Name"] = TextBox1.Text.ToString();
protected void Page_Load(object sender, EventArgs e)
Label1.Text = "Hi, " + (string)Session["Name"];
The result of this work demo: