隐藏asp.net中的pass值 [英] hide the pass value in asp.net

查看:123
本文介绍了隐藏asp.net中的pass值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要帮助

我使用asp创建一个网站。这个网站有客户端和服务器端的组合。

如何从另一个页面传递隐藏/安全数据。

这是我使用生成的传递值的代码javascript

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

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

localhost:544696/processUpdate.aspx?id=0&tagnumber=SAMPLETAG&con=GOOD&date=2015-12-2

推荐答案

你有多种方法可以可以在ASP.Net中将值从一个页面传递到另一个页面,如果您希望在传递时隐藏这些值,则可以考虑 -

使用公共属性

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
public int Id
{
    get
    {
        return int.Parse(i);
    }
}
//write properties for other required values similar as above



在目标页面中,在PreviousPageType页面指令中设置源页面。


In the destination page set the source page in PreviousPageType page directive.

<![CDATA[<%@ PreviousPageType VirtualPath="~/SourcePage.aspx" %>]]> 



现在您可以访问该属性,例如


Now you can access the property like

int Id =PreviousPage.Id;





查看此MSDN链接了解更多详情 -

如何:在ASP.NET Web窗体页面之间传递值 [ ^ ]



希望,它有帮助:)



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

Hope, it helps :)


这篇关于隐藏asp.net中的pass值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆