我是新来的ASP.net编程和网络编程一般,所以我不知道所有的条款,但我会尽我所能得到的点跨越。传送大量数据到一个aspx网站,并取回一个图像
我正在写一个图像发生器,它将接收一个字符串并输出一个PNG。我已经能够成功地做到这一点使用访问该网站会生成可用于合适的网页进行进一步显示里面PNG文件的语法LabelGenerator.aspx?epl2=UrlEncodedMessageGoesHere
。但是,问题是我可能有超过2048字节的消息,IIS不喜欢这样。
我知道这样一个POST而不是GET将释放我从2048极限,但是我不知道怎么打发沿,如果我想使用一个IMG标签内所得到的图像信息。
这里是我当前如何做一些代码。
public partial class LabelGenerator : System.Web.UI.Page
{
RotateFlipType RotateFlip;
float Scale;
String LabelCommands;
protected void Page_Load(object sender, EventArgs e)
{
try
{
int rotateFlipInt;
if (!float.TryParse(this.Request.QueryString["Scale"], out Scale))
Scale = 1;
if (!int.TryParse(this.Request.QueryString["RotateFlip"], out rotateFlipInt))
rotateFlipInt = (int)RotateFlipType.Rotate270FlipNone;
RotateFlip = (RotateFlipType)rotateFlipInt;
LabelCommands = this.Request.QueryString["epl2"];
if (LabelCommands != null && LabelCommands.Length > 0)
{
using (var bitmap = GenerateLabel())
{
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "image/png";
bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
}
}
else
{
Response.Write("You did not enter a valid epl2 command");
}
}
catch (Exception ex)
{
Response.Write("An error occurred during processing.");
}
}
private Bitmap GenerateLabel()
{
//(snip)
}
}
iframe解决方案非常适合我需要做的事情。 – 2011-05-01 16:56:19