简体   繁体   中英

iframe src manipulation url encoding/decoding issue

Not sure if it's about encoding/decoding to be honest.

This is my iframe tag on .aspx

<iframe id="ifGtipKontrol" src="TescilData.aspx" runat="server" visible="true" width="500px" height="250px"></iframe>

and this the code behind to manipulate it

ifGtipKontrol.Attributes["src"] += "?mode=GtipKontrol&NctsN=NctsLoaded_" + GetPageSessionTime();

I want it to be sent as;

TescilData.aspx?mode=GtipKontrol&NctsN=NctsLoaded_2414291693072"

but the page source show that it is sent with "amp" in the middle. ( I added ** ** below)

"TescilData.aspx?mode=GtipKontrol**&amp**;NctsN=NctsLoaded_2414321001951"

I tried UrlEncoding, Urldecoding..I even tried toString() but couldn't get it right. Any help?

I tried your Code it works fine :

Aspx:

<iframe id="ifGtipKontrol" src="TescilData.aspx" runat="server" visible="true" width="500px" height="250px"></iframe>

cs:

ifGtipKontrol.Attributes["src"] += "?mode=GtipKontrol&NctsN=NctsLoaded_" + "2243";

Edit :

As per our discussion another approach as you suggested might be helpful for users coming from Search find this useful:

using the ResolveClientUrl

ifGtipKontrol.Attributes["src"] = ResolveClientUrl("~/Firma/Tescil/TescilData.aspx") + "?mode=GtipKontrol&NctsN=NctsLoaded_" + GetPageSessionTime();

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