One of the tasks I had recently was to get not only a web page into a SharePoint page but also pass in parameters from the Query String. Let’s say I am going to create the page at http://localhost/sharepoint/mypage.aspx in a normal way. In order to host a page inside that SharePoint page, we can use a Page Viewer Web Part, but this limits what can be done. Instead, we can create a custom web part to do the work…
Please excuse me if the code isn’t exactly correct. I do not have the code in front of me right now and will update it when I do.
public class CustomWebPart : WebPart {
public override void Render(HtmlTextWriter writer){
string rawUrl = Context.Request.Url.OriginalString;
int index = rawUrl.IndexOf("?");
string query = String.Empty;
if(index != -1) query = rawUrl.Substring(index);
writer.Write(
""
);
}
}