Hi,
Is it possible to convert the following JSP code to ASP.NET?
Is it possible to convert the following JSP code to ASP.NET?
Code:
<%-- Exactly 2 parameters need to be set 1) format 2) filename --%> <%@page import="java.io.*,java.net.URLDecoder,emaxon.formats.MolImporter,emaxon.struc.Molecule"%> <% try { // Retrieving GET/POST parameters String format = request.getParameter("format"); if(format == null) { throw new Exception("Format needs to be specified."); } String filename = null; String molstring = null; if((filename = request.getParameter("file")) == null) { if((molstring = request.getParameter("mol")) == null) { throw new Exception("Structure needs to be specified."); } } // Setting content type String type = format.indexOf(":") == -1 ? format : format.substring(0, format.indexOf(":")); response.setContentType("image/" + type); // Creating the molecule Molecule mol = null; if(molstring == null) { // Reading the file File f = new File(filename); MolImporter mi = new MolImporter(f,""); mol = mi.read(); } else { // Reading the posted SMILES string mol = MolImporter.importMol(molstring); } // Calculate the coordinates if needed (for example // if the input is SMILES) if(mol.getDim()==0) { mol.clean(2, "O1"); } // Generating the image byte[] b = mol.toBinFormat(format); ServletOutputStream outs = response.getOutputStream(); outs.flush(); outs.write(b,0,b.length); outs.close(); } catch(Throwable t) { t.printStackTrace(); } %>
Comment