- Chen Mey Lee
- PowerBuilder
- Monday, 19 April 2021 01:59 AM UTC
Hi,
I tried to get Response hander from web page but it return empty value when the header value get from Form.Data. It worked when hardcode the value (refer to below dbweb.aspx ) :-
PB logic:-
int li_rc, li_status
string ls_header, ls_body,ls_ContentType
HttpClient lnv_HttpClient
lnv_HttpClient = Create HttpClient
lnv_HttpClient.SetRequestHeader("Content-Type", "text/html; charset=utf-8")
li_rc = lnv_HttpClient.SendRequest("POST", "http://10.204.185.43/APT/dbweb.aspx")
li_status = lnv_HttpClient.GetResponseStatusCode()
if li_rc = 1 and ( li_status = 200 OR li_status = 302) then
ls_header= lnv_HttpClient.GetResponseHeader("dbwebparms")
messagebox("ls_header", ls_header)
end if
-----------------------------------------
default.aspx :
<html>
<head>
<title>APT</title>
</head>
<body>
<form id="apt" runat="server" action="dbweb.aspx" method="post">
<label for="UID">Login ID:</label>
<input type="text" id="UID" name="UID"><br><br>
<label for="PWD">Password:</label>
<input type="password" id="PWD" name="PWD"><br><br>
<input type="submit" value="Submit">
<input type="hidden" id="COMP" name="COMP" value="031">
<input type="hidden" id="PLAN" name="PLAN" value="32">
<input type="hidden" id="SSN" name="SSN" value=>
<input type="hidden" id="ENV" name="ENV" value="DEVELOP">
<input type="hidden" id="APP" name="APP" value="SB">
<input type="hidden" id="EXE" name="EXE" value="pension.exe">
</form>
</body>
</html>
----------------------------------------------------------------------------
dbweb.aspx :
<script>
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
if (Response.IsClientConnected)
{
int loop1;
NameValueCollection coll;
string ls_name;
string ls_value;
//Load Form variables into NameValueCollection variable.
coll=Request.Form;
// Get names of all forms into a string array.
String[] arr1 = coll.AllKeys;
StringBuilder sb = new StringBuilder();
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
ls_name = null;
ls_value = null;
ls_name = arr1[loop1];
ls_value = coll[arr1[loop1]];
if (ls_name == "COMP" || ls_name == "PLAN" || ls_name == "SSN" || ls_name == "ENV"
|| ls_name == "APP" || ls_name == "EXE" || ls_name == "APP" || ls_name == "UID" || ls_name == "PWD"
&& ls_value != null)
{sb.Append(string.Format("/{0}={1} ", ls_name, ls_value));}
}
string ls_parms;
ls_parms = null;
ls_parms = sb.ToString();
//Response.Write(ls_parms);
Response.Headers.Add("dbwebparms",ls_parms);
//Response.Headers.Add("dbwebparms", "/UID=adca8li /PWD=123 /COMP=031 /PLAN=32 /SSN= /ENV=DEVELOP /APP=SB /EXE=pension.exe");
Response.Redirect("http://10.204.185.43/APT/dbweb/",true);
}
else
{Response.End();}
}
</script>
-------
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.