0

Scenario : ASP.NET site has a page named ShowDesign.aspx.

ASPX page has lot of controls. I have a DIV tag and I load the images in code behind. DIV is defined something like below in the ASPX.

<div id="pImageHolder" runat="server"></div>

Below is the code behind that loads images.

    protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    //Loop inside PreviewImages which has lots of images.
    foreach (String imgFile in this.PreviewImages)
    {
        Image pImage = new Image();

        pImage.ImageUrl =  imgFile; //URL length is longer. Do something.

        this.pImageHolder.Controls.Add(pImage);
    }
}

Update : Jun 1,2012 -> I have updated this question with more clarity as to what I am trying to do.

In OnInit(), I get the URL of the image (in the above loop). Every image will have unique URL.

Since the URL length of every image is longer, it doesn't display. The solution to this issue seems to be POSTING data to the form. The data that needs to be POSTED will be the URL contents.

The URL contains lot of '&' and I need to submit the contents of each '&' to the form. Don't know if I need to use AJAX or Jquery here.

I need some help here to achieve the above.

Hope my question is clear. If not, please let me know.

4

1 回答 1

0

根据最新评论,这个问题历史和最后你想将数据发布到另一个 url 并获得响应 html。试试这个(我从上一个问题中剪掉了你的原始网址,因为它真的很大):

  string strangeUrl = "http://example.com/is/m//company1/Rec-Sc-105-QL2?setAttr.safe={visible=false}&setAttr.insertedTextPlaceholder={visible=false}";
  string data = strangeUrl.Substring(strangeUrl.IndexOf("?") + 1);

  WebClient wc = new WebClient();
  wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
  string result = wc.UploadString("www.example.com/addres-for-post.aspx", data);
于 2012-06-01T23:03:56.933 回答