Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Convert .net code to Classic ASP

Posted on 2015-01-14
Medium Priority
Last Modified: 2015-01-16
I know this might sound a little strange but I need to convert .net code to classic ASP so that we can use it in a classic ASP web application. I don't really know .net and I think it would take me a while to learn enough to do this myself. A lot of the code repeats itself so If I can get the 'translation' of one of the lines  of each block then I can do the rest myself obviously  :)

Maybe I should do this in parts, any advice is appreciated.


Imports System.EnterpriseServices
Imports System.Runtime.InteropServices
Imports QuikFormsEngine

Public Class clsQuickBridge

    Public Function CallQuik() As String

        Dim strHtml As String = ""
        Dim objQFE As QuikFormsEngine.QuikFormsEngine

        objQFE = New QuikFormsEngine.QuikFormsEngine

        'Enter the credentials for your Quik! account

        objQFE.QuikCustID = "customerid"
        objQFE.QuikUsername = "username"
        objQFE.QuikPassword = "password"

        'Configure settings to run the Quik! Forms Engine          
        objQFE.ErrorLogPath = "c:\TempOutput\"       'Set the location for the error log

        objQFE.OutputTempFiles = False          'If TRUE, writes output files to the computer's temporary directory.          
        objQFE.OutputPath = "c:\TempOutput\"     'If OutputTempFiles is TRUE, this value is ignored          
        objQFE.OutputFileName = "MyFileName"        'Set the name the output file (the file extension ".html" will be added automatically)

        'For test purposes...          
        objQFE.TestDataMode = False         'If TRUE, writes each field’s name as a default value into the field in order to validate that the form was built properly before publishing the form to PUBLISH status.          
        objQFE.TestFinalFormsMode = False   'If TRUE, sets the value indicating whether to view forms in final mode

        'Configure the form viewer window
        objQFE.HTMLTitle = "My Form Viewer Title" 'Sets the title of the HTML page
        objQFE.HTMLMetaNames = "<meta name=""viewport"" content=""width=device‐width, initial‐scale=1.0, user‐scalable=yes, minimumscale=1.0, maximum‐scale=1.0""/>" & _
                                "<meta name=""apple‐mobile‐web‐app‐capable"" content=""yes""/>" & _
                                "<meta name=""apple‐mobile‐web‐app‐status‐bar‐style"" content=""black""/>" 'Sets the meta names for theHTML page as a single string
        'objQFE.HTMLStyles = "" 'Sets the CSS styles for the page as a single string. Be careful about changing this value ‐ be sure toinclude the entire set of styles
        'objQFE.HTMLBodyOnloadFunction = "init()" 'Sets the “onload” function for the Body tag
        objQFE.HTMLLoadingImage = "https://www.quikforms.com/shared/images/quikformviewer/loading.gif"   'Sets the path to the loadingimage to display when the form is loading
        objQFE.HTMLLogoPath = "https://www.quikforms.com/shared/images/quikformviewer/logo.png"   'Sets the full URI path to the logofile ‐ 150px wide by 65px tall
        objQFE.HTMLLogoAltText = "Quik! Forms"  'Sets the logo image alternate text
        objQFE.HTMLMainInstruction = "Fill Out These Forms."   'Sets a custom main instruction on the form viewer
        objQFE.HTMLMinorInstruction = "Please fill out the forms below and click SUBMIT when you're done."   'Sets a custom minorinstruction on the form viewer

        objQFE.HTMLFieldFontColor = "#000000"   'Sets the font color for field data ‐ default is "Blue"
        objQFE.HTMLFooter = "Forms powered by Quik! ‐ <a href=""http://www.QuikForms.com"" target=""_blank"">www.QuikForms.com</a>"
        'Sets the value to display as the footer
        'objQFE.HTMLFooterStyle = ""    'Sets the HTML footer CSS or style in CSS format. Be careful about changing this value ‐ besure to include the entire set of styles

        '‐‐ Buttons ‐‐
        objQFE.HTMLShowButtonClear = True   'If true, shows the CLEAR button
        objQFE.HTMLShowButtonReset = True   'If true, shows the RESET button
        objQFE.HTMLShowButtonPrint = True   'If true, shows the PRINT button
        objQFE.HTMLShowButtonSave = True    'If true, shows the SAVE and LOAD buttonS
        objQFE.HTMLShowButtonSubmit = True  'If true, shows the SUBMIT button

        objQFE.SaveURL = "https://www.MyURL.com/SaveForm.html" 'The web page where you want the form to be saved to. NOTE: If set, thisoverrides the default save button functionality
        objQFE.SubmitURL = "https://www.MyURL.com/RecieveData.html" 'The web page where you want submitted data to be posted to

        'If you want to create your own javascript to control the submit action, then enter a custom javascript that will runwhen the Submit button is clicked. By default the submit action will POST the data to a URL, but you can override this functionality toperform validations, AJAX calls, etc.

        'objQFE.SubmitJavascript = "$.ajax({url:""https://websvcs.quikforms.com/HTMLFormViewTrans/v5202/FormViewHTML/QFVGetPDF.aspx?Edit=FALSE?"", type: 'POST', data: $('#QFVFormPage').serialize(),success : function(data) {  alert('Print routing succeeded: Form size: '+data.length + ' Bytes');}});"

        'objQFE.CustomJavaFileIncludePath = "https://www.MyURL.com/scripts/myCustomScript.js" 'Sets the customer’s custom javascriptfile path in an include statement within the <HEAD> tag. Only provide the URI, as the QFE will create the HTML tags automatically.
        'objQFE.CustomJavaScript = ""    'Sets the customer’s custom javascript text (function) in HTML format to append to the end ofthe HTML file. Entire script and proper tags must be included. Multiple scripts can be added as additional items, added to the list inorder of preference.
        'objQFE.jQueryFilePath = "https://www.quikforms.com/shared/scripts/QFE/jquery‐1.9.1.min.js" 'Sets the “src” attribute for thejQuery javascript file to use with the forms. Default version is 1.8.3 located in the “javascripts” folder where the HTML file issaved. (“javascripts/jquery‐1.9.1.min.js”)
        'objQFE.iScrollFilePath = "https://www.quikforms.com/shared/scripts/QFE/iscroll.js"  'Sets the “src” attribute for the iScrolljavascript file to use with the forms. Default version is 4.0 located in the “javascripts” folder where the HTML file is saved. (“javascripts/iscroll.js”)

        'Add the FormIDs to generate
        'NOTE: This would generally be done programmatically in a loop for all the forms selected by a user, not by setting explicithard‐coded values

        'Add data to prefill onto the form
        'NOTE: This would generally be done programmatically in a loop, not by setting explicit hard‐coded values
        objQFE.AddFieldToForm("1own.LName", "Smith")

        'objQFE.AddFieldToForm( _
        '  FieldName:="1own.H.Addr123", _
        '  FieldValue:="123 Main Street", _
        '  FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
        '  FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
        '  FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)

        'objQFE.AddFieldToForm( _
        '  FieldName:="1own.H.State", _
        '  FieldValue:="CA", _
        '  FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
        '  FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
        '  FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)

        'objQFE.AddFieldToForm( _
        '  FieldName:="1own.H.City", _
        '  FieldValue:="Los Angeles", _
        '  FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
        '  FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
        '  FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)

        'objQFE.AddFieldToForm( _
        '  FieldName:="1own.H.Zip", _
        '  FieldValue:="90007", _
        '  FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
        '  FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
        '  FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)

        'Sample settings
        objQFE.PreviewMode = False  'Set to TRUE to display form as preview only              
        objQFE.HostFormOnQuik = False   'Set to TRUE to return a URL to the HTML form instead of the raw HTML              
        objQFE.LogoURL = "http://www.quikforms.com"
        'objQFE.SetFieldPropertyByRole("1own", QuikFormsEngine.QFD.FieldReadOnly.Read_Only)
        'objQFE.SetFieldPropertyByFieldName("AcctNum", True) 'Mask the input like a password (shows * for each character entered)
        'objQFE.SetFieldPropertyByFieldName("SSN", "###‐##‐####")
        ''Force the value entered to be numeric and formatted (# = number, a = alpha)              
        'objQFE.SetFieldPropertyByFieldName("DOB", QuikFormsEngine.QFD.FieldReadOnly.Read_Only)
        'Set all date of birth fields to read‐only

        'Run the Quik! Forms Engine and return the HTML file name
        Dim arrFiles As ArrayList = Nothing
        arrFiles = objQFE.Execute

        'Check for errors in running the Quik! Forms Engine
        If objQFE.Results.ErrorFlag Then
            strHtml = "ErrorFlag = 1"
            'Redirect to the HTML file              
            'Dim objFile As QuikFormsEngine.QuikFormOutput              
            'For Each objFile In arrFiles              
            '    Dim strFileName As String = objFile.FullName              
            '    If strFileName = "" Then              
            '        strFileName = "ERROR! No forms were generated."              
            '        Response.Write(strFileName)              
            '    Else              
            '        Response.ContentType = "text/html"              
            '        Response.Redirect(strFileName)              
            '    End If              

            'Write the HTML file out as a response

            Dim objFile As QuikFormsEngine.QuikFormOutput

            For Each objFile In arrFiles
                strHtml = objFile.HTMLData
                If strHtml = "" Then
                    strHtml = "ERROR! No forms were generated."
                End If

        End If

        Return strHtml

    End Function

End Class

Question by:amucinobluedot
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 27

Accepted Solution

Shaun Kline earned 1000 total points
ID: 40551824
Instead of converting the code to classic ASP, I suggest doing one of two things:
1.) Create a web service that calls your .Net code, and from your classic ASP code, call the web service.
2.) Create a class library (DLL) in .Net with the appropriate entry points, and then use Server.CreateObject to create a reference in your classic ASP code, then call the desired entry points.

Both options would remove the need for conversion, and allow you to make changes to your .Net code without having to reconvert every time.
LVL 34

Assisted Solution

by:Paul MacDonald
Paul MacDonald earned 1000 total points
ID: 40551837
1) I've requested moderator intervention for reasons they will make clear to you.

2) Converting this from ASP.Net to classic ASP will almost certainly not be possible because the QuickForms product may or may not be reference-able from classic ASP.  Have you asked QuickForms about compatibility with classic ASP?

3) Is this code you own?  Or did this code come with the QuickForms product?

Author Comment

ID: 40551859
We have that bridge to call the .net, we are trying to bypass that bridge by converting the code.
I will close the ticket and leave the bridge working as it is. thanks.

Author Closing Comment

ID: 40551860

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question