简体   繁体   中英

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.

this works fine, the page loads and if I right-click - properties, I get the url+parameters as expected eg -

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

If I load the page in a browser without the iframe Request.QueryString["id"] has the guid as expected.

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. In order to do it you will need to pass your parameters in the source of the iframe like so:

<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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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