#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2009
    Posts
    7
    Rep Power
    0

    Can I pass data from a VBScript back to Classic ASP?


    Ok, so I have found a solution to my ASPEmail problem by creating a VBSCRIPT that can read a URL into a VBSCRIPT variable. Problem is, can I get that data back to my ASP program?

    Here is the VB code in my asp form:

    url_text = "../Email_Management/emailer_2.asp?Login_Contact_ID=" & "7241" _
    & "&client_id=" & "636" _
    & "&role=" & "adm" _
    & "&current_emailer=" & "e551608524x8726863158y867309z" _
    & "&connect_test_enviroment=" & "true"

    content_1 = convert_text(url_text)



    This VBScript essentially creates a variable field that reads my asp form. I intend on now using the variable 'content_1' in ASPEmail as the email body text. However, I can't figure out how to pass this info back to my asp form. Can I do that? Thanks as always.

    Regards,
    Steve




    ' Set template body
    Public Function convert_text(SM_body)
    Dim Content, regEx, regExSub, SubMatch, Matches, Match, FullUrl, theFullPath
    ' Use file as body
    Content = ""
    contentType = "html"

    if InStr(SM_body, "://") = 0 then
    SM_body = getCurrentPath() & SM_body
    end if
    debug "Body = <font color=""#000099""><b>" & SM_body & "</b></font><br/>"

    Content = getUrl(SM_body)
    theFullPath = getPath(SM_body)

    End Function

    ' Get a specific URL via HTTP
    Private Function GetUrl(SM_Url)
    Dim objHttp, objText, HttpComponent
    HttpComponent = GetHttpComponent()

    on error resume next
    set objHttp = Server.CreateObject(HttpComponent)
    if err.number <> 0 then
    Response.Write "ERROR: Can not get Template URL!<br>" & err.description & "<br/>"
    done
    Response.End
    end if
    on error goto 0

    objHttp.open "GET", SM_Url, false
    objHttp.setRequestHeader "User-Agent", Request.ServerVariables("HTTP_USER_AGENT")
    objHttp.Send ""
    objText = objHttp.responseText
    ' Check notification validation
    if (objHttp.status <> 200 ) then
    ' HTTP error handling
    Response.Write "HTTP ERROR: " & objHttp.status & "<br/>"
    Response.Write "Returned:<br/>" & objHttp.responseText
    done
    Response.End
    end if

    GetUrl = objText
    End Function
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    15
    Rep Power
    0
    It's not very clear what you are doing here.

    -to get form data use Request.form("FieldNameHere")

    -to get url data use Request.querystring("KeyNameHere")

    -to return a value into a form use

    Response.write(VariableNameHere)

    or

    <%= VariableNameHere %>

IMN logo majestic logo threadwatch logo seochat tools logo