简体   繁体   English

Iframe内部的Request.Querystring == null

[英]Request.Querystring == null from inside Iframe

I have a simple mvc page that is being loaded in an iframe on a tab of the account record in dynamics crm, set to pass the parameters through. 我有一个简单的mvc页面,该页面正在iframe中加载到动态crm的客户记录标签中,设置为通过参数传递。

this works fine, the page loads and if I right-click - properties, I get the url+parameters as expected eg - 这工作正常,页面加载,如果我右键单击-属性,则按预期获得url + parameters,例如-

http://myserver.com/?type=1&typename=account&id={816E90BE-7DBC-DD11-9E0B-001C25CFAE82}&orgname=MyOrg&userlcid=1033&orglcid=1033

However, in the controller I have 但是,在控制器中

Request.QueryString["id"]

and this returns null, also Request.QueryString is null 并且返回null,Request.QueryString也为null

If I load the page in a browser without the iframe Request.QueryString["id"] has the guid as expected. 如果我在没有iframe的浏览器中加载页面,则Request.QueryString [“ id”]具有预期的GUID。

What stupid thing have I missed? 我错过了什么愚蠢的事情?

I don't believe you can do this the way you want because the request for your application is coming from the iframe instead of the user. 我认为您无法按照自己的意愿进行操作,因为对您的应用程序的请求来自iframe,而不是用户。 In order to do it you will need to pass your parameters in the source of the iframe like so: 为此,您需要像这样在iframe的源中传递参数:

<iframe id="ThePage" src="mypage.aspx?id={816E90BE-7DBC-DD11-9E0B-001C25CFAE82}"></iframe>

You can almost think of the request as being proxied. 您几乎可以认为请求已被代理。 If Jack tells Jon and Jon tells Jill, Jill has no knowledge of Jack unless Jon tells her. 如果杰克告诉乔恩而乔恩告诉吉尔,除非乔恩告诉她,否则吉尔不知道杰克。

Let me know if this answers your question. 让我知道这是否回答了您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM