user2199913
user2199913

Reputation: 11

Using a Servlet from ASP .NET

Is there a way to use a Servlet from my aspx page? My application is running on the IIS server. I want on a button click to be able to run the Java code present in Servlet's method.

Upvotes: 1

Views: 535

Answers (1)

BalusC
BalusC

Reputation: 1109874

Yes, there are ways.

  1. Deploy the servlet to a servletcontainer the usual way, e.g. on the same server. This way the ASP.NET program can invoke a HTTP web request on the URL of the servlet and obtain its HTTP response body as a stream or a string.

  2. Refactor servlet's code into a standalone Java class which you can invoke via an applet embedded on the page, or via the command runtime like java com.example.SomeClass.

  3. Port the Java code to C#/.NET code, so that it can just be run in the same context as your ASP.NET program.

Upvotes: 2

Related Questions