Friday, July 4th, 2008

Talking to .NET on the server with Jaxer

Category: .NET, Aptana

<>p>What does your CEO do? Paul Colton, CEO of Aptana, gets his fingers dirty. He just wrote a post about accessing COM objects from JavaScript with Jaxer.

This is possible as the JavaScript is running on the server, and this server is running on Windows. You can download the source code to check it all out.

  1. <html>
  2.      <body>
  3.          <script runat="server-proxy">
  4.              function rotate(angle)
  5.              {
  6.                  var img = COMObject("ImageProcessor.ImageProcessing");
  7.  
  8.                  img.LoadImage(Jaxer.request.documentRoot + "/photo.jpg");
  9.                  img.RotateImage(angle);
  10.                  img.SaveImage(Jaxer.request.documentRoot + "/new.jpg");
  11.              }
  12.          </script>
  13.          <input id="angle"/>
  14.          <input type="button" value="Rotate"
  15.                        onclick="rotate(document.getElementById('angle').value);
  16.                                document.getElementById('img').src =
  17.                                document.getElementById('img').src + '?' + new Date()"/>
  18.          <br />
  19.          <img id='img' src="new.jpg"/>
  20.      </body>
  21. </html>

Related Content:

5 Comments »

Comments feed TrackBack URI

If only existed a way to do the same thing for Java.. (as easy as the above.)

Comment by PedroBatista — July 4, 2008

Wow, who knew you needed Javascript to make COM less evil to use ;)

Comment by Unfocused — July 4, 2008

1) COM != .Net

2) The example is just the same as using ClassicASP/JScript on the server and calling “new ActiveXObject()”

Comment by RichB — July 5, 2008

You can do this easly with java . We don’t need longer.

Comment by Loadtr — September 22, 2008

but how could it possible to create a ActiveX or a ASP.NET DLL cal from this thing.

Comment by vks2009 — December 7, 2011

Leave a comment

You must be logged in to post a comment.