Click here to Skip to main content
14,836,551 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to create a HTTP get to a third party application. I am able to make a initial call. When I check the activity using fiddler, the initial request goes through fine. But this URL internally calls other URL which has a referential path. For the referential path, it using http://localhost:56364 as host instead of http://fmiswebfocus.

How can I fix this?

What I have tried:

Here is my code. I have also provided some info from fiddler
HttpWebRequest request2;
HttpWebResponse response2;
Stream webStream2;
String webResponse2 = string.Empty;

string reportURL = "http://fmiswebfocus/ibi_apps/bip/portal/ContPerfTSOPROD";
request2 = (HttpWebRequest)WebRequest.Create(reportURL);

Uri u1 = new Uri(reportURL);
System.Net.CookieContainer cookies1 = new System.Net.CookieContainer();
cookies1.Add(u1, JSESSION);
request2 = (HttpWebRequest)HttpWebRequest.Create(u1);
request2.Method = "GET";
request2.KeepAlive = true;

request2.CookieContainer = new CookieContainer();
request2.CookieContainer = cookies1;

request2.Host = "fmiswebfocus";

response2 = (HttpWebResponse)request2.GetResponse();

Here is the output from fiddler for initial request

GET http://fmiswebfocus/ibi_apps/bip/portal/ContPerfTSOPROD HTTP/1.1
 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; Touch; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)
 Referer: http://fmiswebfocus
 Host: fmiswebfocus
 Cookie: JSESSIONID=D90F71485CD25E3CAD1C586799D896CC
 Here is the body of the response for this request 
 		<script type="text/javascript">application.start("/ibi_apps/bindows", "/ibi_apps/tools/portal/resources/markup/wfbiportalrun.jsp?&ViewID=VIEWROOT-K5YAH5ZC10LN8VYT2C9233&ViewName=ContPerfTSOPROD&ViewTitle=Cont%2BPerf%2BTSO%2BPROD&ViewPath=IBFS%253A%252FBIP%252FPortals%252FContPerfTSOPROD&SessionTimeout=7200000")</script>
 Here is the next request (happening internally) based on previous response.
 <pre>GET http://localhost:56364/ibi_apps/bindows/css/bimain.css HTTP/1.1
 Accept: */*
 Referer: http://localhost:56364/Default.aspx?ID=MDOTHQ\NSUBRAMANIAN
 Accept-Language: en-US
 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; Touch; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)
 Accept-Encoding: gzip, deflate
 Host: localhost:56364
 Connection: Keep-Alive
 Cookie: CMDBAuthCookie=891623DD81BBE3FE4F6D8E7535ACB

I get response as
HTTP/1.1 404 Not Found
because the host now changed to localhost:56364. I want the host to remain fmiswebfocus for all the internal requests also.
Updated 18-Nov-20 19:30pm

1 solution

It looks like you need to have the App Studio Windows-based development environment installed:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900