ASP.NET - >如何发布数据的形式,使得图像显示 [英] ASP.NET -> How to POST data to the form such that images are displayed

查看:132
本文介绍了ASP.NET - >如何发布数据的形式,使得图像显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景:ASP.NET网站上有一个名为ShowDesign.aspx页

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

ASPX页面有很大的控制。我有一个DIV标签和我code加载图像后面。 DIV在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>

下面是落后于code加载图像。

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);
    }
}

更新:君1,2012 - > 我已经更新了这个问题更加清晰,以什么我试图做的。

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

在的OnInit(),我得到的图像的URL(在上面的循环)。每一个形象,将有唯一的URL。

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

由于每个图像的URL长度较长,它不显示。对这一问题的解决方案似乎张贴的数据形式。需要发布的数据将是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.

URL中包含大量的'和;'我需要提交的每个内容'和;'到窗体。
不知道是不是我需要使用AJAX或jQuery的在这里。

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.

推荐答案

据最新的评论,这个问题的历史,并在年底你想POST数据到另一个URL,并得到响应HTML。试试这个(我剪断你的原始地址从previous的问题,因为是真大):

According to latest comments, this question history and at the end you want post data to another url and get response html. Try this (I snipped your original url from previous question since is really big):

  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);

这篇关于ASP.NET - &GT;如何发布数据的形式,使得图像显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆