S
Shashank
Hi all,
I am a new member of this community.
I am making a http request to a html file placed on a Apache server.
On this page there is an embeded perl statement which requires
reading environment variables from the server.
When I am typing the url of the html page in my browser, I am able to
read the Environment variables from the server and getting the desired
results.
But, when I am making Http request through my window application, it
is unable to read the the environment variables.
Please help me out.
The code used is given below:
private void GetFile(string FilePath)
{
using (WebClient wcDownload = new WebClient())
{
string strFile ="test.xml";
try
{
// Code for reading the html file from the server
String downloadUrl = @"http://www.mysite/
folder_job.html";
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(downloadUrl);
webRequest.Timeout = 15000;
webRequest.Credentials =
CredentialCache.DefaultCredentials;
webResponse =
(HttpWebResponse)webRequest.GetResponse();
Int64 fileSize = webResponse.ContentLength;
strResponse = wcDownload.OpenRead(downloadUrl);
//End Code
strLocal = new FileStream(strFile,
FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
int bytesSize = 0;
byte[] downBuffer = new byte[4096];
while ((bytesSize = strResponse.Read(downBuffer,
0, downBuffer.Length)) > 0)
{
strLocal.Write(downBuffer, 0, bytesSize);
}
strResponse.Close();
strLocal.Close();
webResponse.Close();
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
}
}
I am a new member of this community.
I am making a http request to a html file placed on a Apache server.
On this page there is an embeded perl statement which requires
reading environment variables from the server.
When I am typing the url of the html page in my browser, I am able to
read the Environment variables from the server and getting the desired
results.
But, when I am making Http request through my window application, it
is unable to read the the environment variables.
Please help me out.
The code used is given below:
private void GetFile(string FilePath)
{
using (WebClient wcDownload = new WebClient())
{
string strFile ="test.xml";
try
{
// Code for reading the html file from the server
String downloadUrl = @"http://www.mysite/
folder_job.html";
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(downloadUrl);
webRequest.Timeout = 15000;
webRequest.Credentials =
CredentialCache.DefaultCredentials;
webResponse =
(HttpWebResponse)webRequest.GetResponse();
Int64 fileSize = webResponse.ContentLength;
strResponse = wcDownload.OpenRead(downloadUrl);
//End Code
strLocal = new FileStream(strFile,
FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
int bytesSize = 0;
byte[] downBuffer = new byte[4096];
while ((bytesSize = strResponse.Read(downBuffer,
0, downBuffer.Length)) > 0)
{
strLocal.Write(downBuffer, 0, bytesSize);
}
strResponse.Close();
strLocal.Close();
webResponse.Close();
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
}
}