473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How get Request.Querystring from IFrame page

I have an ASPX page that is used for content. I have a master page which
sticks the page in an IFrame.

Question: From the content/ASPX page, I can't seem to reference
request.querystring. Any way around this? I need to read it.

Thanks!
Nov 18 '05 #1
5 10977
VB Programmer wrote:
I have an ASPX page that is used for content. I have a master page
which sticks the page in an IFrame.

Question: From the content/ASPX page, I can't seem to reference
request.querystring. Any way around this? I need to read it.


The "outer" page should be constructed in such a way that it appends the
query string to the IFRAME's target URL.

Cheers,

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de
Nov 18 '05 #2
How do I do that?

"Joerg Jooss" <jo*********@gmx.net> wrote in message
news:uo****************@TK2MSFTNGP14.phx.gbl...
VB Programmer wrote:
I have an ASPX page that is used for content. I have a master page
which sticks the page in an IFrame.

Question: From the content/ASPX page, I can't seem to reference
request.querystring. Any way around this? I need to read it.


The "outer" page should be constructed in such a way that it appends the
query string to the IFRAME's target URL.

Cheers,

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de

Nov 18 '05 #3
VB Programmer wrote:
How do I do that?


Make the IFRAME a HtmlControl and append Request.QueryString to the IFRAME's
"src" attribute in the outer page's code behind class.

Cheers,
--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de

Nov 18 '05 #4
Any examples of how to do this? Thanks!

"Joerg Jooss" <jo*********@gmx.net> wrote in message
news:uQ**************@TK2MSFTNGP14.phx.gbl...
VB Programmer wrote:
How do I do that?


Make the IFRAME a HtmlControl and append Request.QueryString to the
IFRAME's "src" attribute in the outer page's code behind class.

Cheers,
--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de

Nov 18 '05 #5
VB Programmer wrote:
Any examples of how to do this? Thanks!


Here's the code-behind class for a Web Form with an IFRAME HTML control with
an ID "iframe", that shows how to append the Web Form's query string to the
IFRAME's src attribute:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace TestWebApp {
/// <summary>
/// Zusammenfassung für IFrameDemo.
/// </summary>
public class IFrameDemo : System.Web.UI.Page {
protected System.Web.UI.HtmlControls.HtmlGenericControl iframe;

private void Page_Load(object sender, System.EventArgs e) {
this.iframe.Attributes["src"] += UrlEncodedQueryString;
}

private string UrlEncodedQueryString {
get {
ICollection keys = Request.QueryString.Keys;
StringBuilder builder = new StringBuilder("?", 2048);
foreach (string key in keys) {
builder.AppendFormat("{0}={1}&", key,
HttpUtility.UrlEncode(
Request.QueryString[key],
Encoding.UTF8));
}
// This will either cut the ? for empty query strings
// or the surplus & for non-empty ones. Just makes the
// query string look nice all the time ;-)
builder.Length -= 1;

return builder.ToString();
}
}

// Cut generated code...
}

As you can see, it's trivial. The interesting part was providing a means to
URL encode the query string again (there seems to be no method in the FCL
that works on an existing query string without escaping & or ? as well).

Note that this sample assumes the query string's URL encoding is UTF-8
based.

Cheers,

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: momo | last post by:
Hello Newsgroup, I want to pass a Request.Form variable to an ASP form, through the url for example lets say i have a form with a textfiled called "txtName" if i click the submit button for...
4
by: Max | last post by:
Hello. This is the first time I've posted to a newsgroup, and I do this because I'm in desperate need of help. I'm working a user management system, and when I activate a user that has registered...
1
by: franklinbruce | last post by:
Hi all, I am passing a value from Javascript to a IFrame. when i tired to acces that value like request.querystring("id1") it says "name id1 is not declared" code as follow: ---------------...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
7
by: SevDer | last post by:
Hi I have a class library that needs to download the HTML in a specific page of ours with provided querystring. When I open this URL with any browser, it loads fine. When I do WebRequest from Web...
4
by: Arvan | last post by:
there is 3 links to page default.aspx,and each one has a querystring,like a=1, b=1 ,c=1. problem is how do i ensure the name of querystring! how do?
7
by: eric.goforth | last post by:
Hello, I'm working with a classic asp page that calls another classic asp page. The html in my calling page looks like: <form method="post"...
2
by: David | last post by:
I have a ASP.Net 2.0 page with a Gridview that contains a hyperlink column that takes me to a new page and puts value of ID into a querystring and it works fine. However, when I try to use...
4
by: David C | last post by:
I have an aspx page that contains an iframe where I point to another aspx page. In the aspx page that is in the iframe, I have VB code as follows: <script language="vb" runat="server"> Dim...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.