一个asp.net页面和弹出页面之间发送数据? [英] Sending data between an asp.net page and a pop up page?

查看:104
本文介绍了一个asp.net页面和弹出页面之间发送数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是asp.net页面和弹出页面的沟通方式的不同?查询字符串等,这是最安全的?

What are the different ways of communication between asp.net page and a popup page? Query strings etc. Which is most secure?

推荐答案

您说的弹出式和主要ASP.NET页面之间的通信。首先,我认为弹出式是一个ASP.NET页面,以及因此从主页,弹出通信是从一个页面到一系列页面的下一个通信没有什么不同。即,可以存储,然后在会话中使用的数据(如果被装入的主网页时数据是可用的),通过查询字符串等。除非该数据是敏感,迄今为止的最简单的方法是包括可变的调用由相应的参数取代了弹出。下面是一个示例图像链接:

You say "communication between" the pop-up and the main ASP.NET page. First, I assume that the pop-up is an ASP.NET page as well so the communication from the main page to the pop-up is no different from the communication from one page to the next in a series of pages. That is, you can store and then use data in the session (if the data is available when the main page is loaded), via query strings, etc. Unless the data is sensitive, the simplest way by far is to include a variable in the call to the pop-up that is replaced by the appropriate arguments. Here is a sample image link:

<img style='cursor:hand;' alt="Open Note" onclick="javascript:window.open('NoteEdit.aspx?T=3&UID=<%#NoteUID%>', 'Note', 'HEIGHT=400,WIDTH=420');" src="images/Note.gif" />

请注意了NoteUID替代说法。

Note the "NoteUID" replacement argument.

更有趣的问题是如何将信息传递回那个弹出的弹出窗口。要做到这一点,开始与这个JavaScript:

The more interesting question is how to pass information back to the window that popped up the pop up. To do that, start with this javascript:

<script type="text/javascript">
    function OpenHRAResults()
    {
        opener.location.href="<%#DestName%>";
        window.close();
    }
</script>

这是从code带到了哪里我重新打开特定网页,但正如您可以猜到,你可以做各种各样的事情用开门红窗口(即弹出的弹出窗口)

This is taken from code where I re-open a specific page but, as you can guess, you can do all sorts of things with the "opener" window (the window that popped-up the pop up).

希望这有助于...

这篇关于一个asp.net页面和弹出页面之间发送数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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