Encoding iframe source

G

Guest

(This is about a site in our interanet)
I have an aspx page which has a iframe on it. I would like my page to be
called by get paramters passing into it a paramter called url and I
dynamically create a link based on the passed url and make it the source of
my iframe . by this way people can link to my default.aspx and pass required
get paramter to show an html page stored in a folder in home page of my site.
Problem is that if there is space get paramter , it is dropped when I assign
it to the src of the iframe ,so iframe cannot show the page.

I asked the users to send me encoded url and I decoded in my page , but
still the same problem exists:

I would appreciate your help:

here is the code:

<%

string iURL = Request.QueryString["url"];

if (iURL == null)
iURL = "shared%20documents/default.html";
else
{
string fullLink =
Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context).Url + "/" +
iURL;
try
{
//Check to see if the page exist
HttpWebRequest userReq = (HttpWebRequest)WebRequest.Create(fullLink);
userReq.AllowAutoRedirect=false;
userReq.Credentials = System.Net.CredentialCache.DefaultCredentials;
HttpWebResponse serverResponse = (HttpWebResponse) userReq.GetResponse();
if(serverResponse.StatusCode != HttpStatusCode.OK)
{
iURL= "shared%20documents/Error.html";
}
}
catch(Exception ex)
{
iURL= "shared%20documents/Error.html";

}
}

%>
<iframe id="WebpartWPQ1" name="frame1" width="100%" frameBorder="0"
src=<%=iURL%> ddf_src=<%=iURL%>>
</iframe>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top