MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica Graphics output in an ASP.NET WebApplication

  • To: mathgroup at
  • Subject: [mg53504] Re: Mathematica Graphics output in an ASP.NET WebApplication
  • From: "Javier Chicote" <goraperas at>
  • Date: Fri, 14 Jan 2005 08:55:12 -0500 (EST)
  • References: <cs5beb$3tt$>
  • Sender: owner-wri-mathgroup at

Hello Hans,

Thank you very much for your response, now I can see the image in my
application, although I still have a problem:

I would like the use the "mathKernel.Compute" and "mathKernel.Graphics"
methods in my application, but I must use the
"mathKernel.Link.EvaluateToImage" method to see the image. Do you know why
does [#1] work and [#2] doesn't in the following code?? As far as I know,
both EvaluateToImage and mathKernel.Graphic[0] methods return an
System.Drawing.Image object.

private void Page_Load(object sender, System.EventArgs e)
      mathKernel = new Wolfram.NETLink.MathKernel();
      string path = "C:/Archivos de programa/Wolfram
      mathKernel.LinkArguments = "-linkmode launch -linkname \"" + path +
      string input = "Plot3D[Sin[x y], {x, -Pi, Pi}, {y, 0 ,10}]";

      // #1 This works OK :)
      System.Drawing.Image img =

      // #2 This does NOT work :(
//    mathKernel.Compute(input);
//    System.Drawing.Image img = mathKernel.Graphics[0];

      img.Save(Response.OutputStream, ImageFormat.Jpeg);



<hmichel at> escribió en el mensaje news:cs5beb$3tt$1 at
> Javier Chicote
> You are streaming a jpeg image to the image element with src attribute url
Webform2.aspx in WebForm1.aspx page.
> The image you stream must be for lack of a better term well formed. Now if
you were to take a jpeg image and add html text tag or any extraneous
characters to that file most programs may not know how to render it. This is
what is happening on WebForm2.aspx. You have extraneous characters.
> Remove the DOCTYPE Declaration. No HTML or anything except for the page
directive. Response stream must be neat.
> Just
> "<%@ Page lan .... %>"
> WebForm2
> ============================================================
> <%@ Page language="c#" Codebehind="WebForm2.aspx.cs"
> Inherits="mathGraph.WebForm2" EnableSessionState="False"
> enableViewState="False" contentType="image/jpeg"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
> Remove the preceding document type declaration
> Hans

  • Prev by Date: Re: Problem with transformation rule of a function
  • Next by Date: Re: Re: Newbie Limit problem
  • Previous by thread: Re: Mathematica Graphics output in an ASP.NET WebApplication
  • Next by thread: Re: Mathematica Graphics output in an ASP.NET WebApplication