Re: How to give back to an image using "Net/Link" and "asp.net"?
- To: mathgroup at smc.vnet.net
- Subject: [mg46848] Re: How to give back to an image using "Net/Link" and "asp.net"?
- From: "Hans Michel" <hansjm at bellsouth.net>
- Date: Thu, 11 Mar 2004 03:50:40 -0500 (EST)
- References: <c2lph7$9c6$1@smc.vnet.net>
- Reply-to: "Hans Michel" <hansjm at bellsouth.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi. WebForm2.aspx HTML page should contain only the page directive <%@ Page ... Should also have EnableSessionState = False enableViewStae=False aspCompat="True" No html code at all. in the code behind I think your missing this Do not use Response.Write and don't ne to tell the content type. just use mathkernel.Graphics(0).Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) Hans "Roger" <albert_666 at hotmail.com> wrote in message news:c2lph7$9c6$1 at smc.vnet.net... > I need aid to create a graph in mathematica and to place it in a page > aspx being used Net/link and asp.net > > I have two paginas aspx WebForm1.aspx and WebFor2m.aspx > WebForm1.aspx calls to WebForm2.aspx to obtain an image: > < img src="WebForm2.aspx "> > > The code of "WebForm2.aspx" is the following one: > > Imports System.Drawing > Imports System.Drawing.Imaging > Imports Wolfram.NETLink > > Public Class WebForm2 > Inherits System.Web.UI.Page > > Private mathkernel As New Wolfram.NETLink.MathKernel > Dim resultado As String > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As _ > System.EventArgs) Handles MyBase.Load > > Response.ContentType = "image/gif" > > If (mathkernel.IsComputing()) Then > mathkernel.Abort() > Else > > mathkernel.GraphicsHeight = 200 > mathkernel.GraphicsWidth = 300 > mathkernel.CaptureGraphics = True > mathkernel.Compute("Plot[x,{x,0,1}]") > > > If (mathkernel.Graphics.Length > 0) Then > Response.Write(mathKernel.Graphics(0)) > End If > > End If > End Sub > > End Class > > > in time of debugin the variable "mathkernel.Graphics.Length" is equal > to 1, but profit not to give back the image to "WebForm1.aspx" >