Member_2_7964962_1
asked on
Receive name of variable not variable content when using Request.QueryString["var1"]
Here is a sample of the Asp.net Webform that is requesting the variable
.NET Webform
'''''''''''''''''''''''''
Here is a copy of the VBA code that is sending the variable
VBA Macro
.NET Webform
protected void Page_Load(object sender, EventArgs e)
{
var var1 = Request.QueryString["var1"];
string testthree = var1
'''''''''''''''''''''''''
Here is a copy of the VBA code that is sending the variable
VBA Macro
''Dim oXMLDoc, oXMLHTTP
Dim strEnvelope As String
Dim response As String
Dim emailvalues As String
Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Set oXMLDoc = CreateObject("MSXML2.DOMDocument")
strEnvelope = "test"
emailvalues = ("var1=strEnvelope")
''Call oXMLHTTP.Open("POST", "http://server/WebForm1.aspx?var1=strEnvelope", False)
Call oXMLHTTP.Open("POST", "http://server/WebForm1.aspx?var1=strEnvelope", False)
Call oXMLHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
Call oXMLHTTP.Send(strEnvelope)
Dim szResponse: szResponse = oXMLHTTP.responseText
Call oXMLDoc.LoadXML(szResponse)
If (oXMLDoc.parseError.ErrorCode <> 0) Then
'call msgbox("ERROR")
'response = oXMLHTTP.responseText&" "&oXMLDoc.parseError.reason
'call msgbox(oXMLDoc.parseError.reason)
Else
'response = oXMLDoc.getElementsByTagName("string")(0).childNodes(0).text
MsgBox (oXMLHTTP.Status)
End If
MsgBox (oXMLHTTP.Status)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
What would be the best way to pass multiple parameters in the string below? For example, var2, and var3
http://server/WebForm1.aspx?var1=" & strEnvelope
http://server/WebForm1.aspx?var1=" & strEnvelope
Something like this:
... "http://server/WebForm1.aspx?var1=" & strEnvelope & "&var2=" & strVar2 & "&var3=" & strVar3
Assuming you have variables strVar2 and strVar3 filled with strings like you have strEnvelope.
Note that & is used both as a seperator in the querystring (after the initial question mark) as well as an operator in the VBA language to concatenate strings.
It also may become more important now you are adding extra variables to think about the other 2 remarks in my first comment.
... "http://server/WebForm1.aspx?var1=" & strEnvelope & "&var2=" & strVar2 & "&var3=" & strVar3
Assuming you have variables strVar2 and strVar3 filled with strings like you have strEnvelope.
Note that & is used both as a seperator in the querystring (after the initial question mark) as well as an operator in the VBA language to concatenate strings.
It also may become more important now you are adding extra variables to think about the other 2 remarks in my first comment.
ASKER
For sure, but not sure how to accomplish this yet. In regards to the remarks in your first comment, would this make the whole process that I am trying to accomplish easier. Some of the values that I am passing our Outlook email items such as senders name, attachments etc.
I am passing the parameters to the following Response.Write link.
The Class is identified below the Response.Write code below. Are you familiar with passing several parameters using Response.Write, and receiving them using HttpPost? See Example below.
Response.Write(Class1.Http Post("http://172.23.0.106:7722/WebService1.asmx?op=MyMethod", test));
public class Class1
{
public static string Errors { get; set; }
public static string HttpPost(string URI, string Parameters)
{
I am passing the parameters to the following Response.Write link.
The Class is identified below the Response.Write code below. Are you familiar with passing several parameters using Response.Write, and receiving them using HttpPost? See Example below.
Response.Write(Class1.Http
public class Class1
{
public static string Errors { get; set; }
public static string HttpPost(string URI, string Parameters)
{
No, it wouldn't make it easier, but it would make it safer and more robust.
The question in the second part of that last post makes little sense to me. You should probably gather some more info and ask a new (related) question. Your audience here will be very limited (possibly just me) now that the question is closed.
The question in the second part of that last post makes little sense to me. You should probably gather some more info and ask a new (related) question. Your audience here will be very limited (possibly just me) now that the question is closed.
ASKER
Thank you, agreed.
ASKER