Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
need help
i create a website using asp. this website have a combination of client and server side.
how can i pass a hidden/secured data from another page.
this is my code in passing value using generated by javascript
C#
button.setAttribute("onClick", "window.location.href='processUpdate.aspx?id="+i+"&tagnumber=" + tag[i]+"&con="+con[i]+"&date="+date[i]+"'");

this code is working fine but the data that i passing is visible which is very dangerous.

this is the sample of the above code
C#
localhost:544696/processUpdate.aspx?id=0&tagnumber=SAMPLETAG&con=GOOD&date=2015-12-2
Posted

1 solution

There are various ways you can pass value from one page to another in ASP.Net and if you want these values to be hidden while passing then you may consider-
Using Public Properties
C#
public int Id
{
    get
    {
        return int.Parse(i);
    }
}
//write properties for other required values similar as above

In the destination page set the source page in PreviousPageType page directive.
HTML
<![CDATA[<%@ PreviousPageType VirtualPath="~/SourcePage.aspx" %>]]> 

Now you can access the property like
C#
int Id =PreviousPage.Id;


Check this MSDN link for more details-
How to: Pass Values Between ASP.NET Web Forms Pages[^]

Hope, it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900