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.Cre ate(downloadUrl );
webRequest.Time out = 15000;
webRequest.Cred entials =
CredentialCache .DefaultCredent ials;
webResponse =
(HttpWebRespons e)webRequest.Ge tResponse();
Int64 fileSize = webResponse.Con tentLength;
strResponse = wcDownload.Open Read(downloadUr l);
//End Code
strLocal = new FileStream(strF ile,
FileMode.Create , FileAccess.Read Write, FileShare.Read) ;
int bytesSize = 0;
byte[] downBuffer = new byte[4096];
while ((bytesSize = strResponse.Rea d(downBuffer,
0, downBuffer.Leng th)) 0)
{
strLocal.Write( downBuffer, 0, bytesSize);
}
strResponse.Clo se();
strLocal.Close( );
webResponse.Clo se();
}
catch (Exception ee)
{
MessageBox.Show (ee.ToString()) ;
}
}
} 1 3140
Shashank,
I would suggest using a utility like Fiddler to intercept the request
from the browser to this url. It sounds like you probably have a cookie on
your machine for the site which the site is interpreting, and then sending
the contents back depending on that. Or it could be the user-agent header
that is causing the issue. Either way, an HTTP interceptor will help you
figure out how to craft your request to the server to get the response back
that you are looking for.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Shashank" <sh************ ***@gmail.comwr ote in message
news:11******** **************@ b75g2000hsg.goo glegroups.com.. .
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.Cre ate(downloadUrl );
webRequest.Time out = 15000;
webRequest.Cred entials =
CredentialCache .DefaultCredent ials;
webResponse =
(HttpWebRespons e)webRequest.Ge tResponse();
Int64 fileSize = webResponse.Con tentLength;
strResponse = wcDownload.Open Read(downloadUr l);
//End Code
strLocal = new FileStream(strF ile,
FileMode.Create , FileAccess.Read Write, FileShare.Read) ;
int bytesSize = 0;
byte[] downBuffer = new byte[4096];
while ((bytesSize = strResponse.Rea d(downBuffer,
0, downBuffer.Leng th)) 0)
{
strLocal.Write( downBuffer, 0, bytesSize);
}
strResponse.Clo se();
strLocal.Close( );
webResponse.Clo se();
}
catch (Exception ee)
{
MessageBox.Show (ee.ToString()) ;
}
}
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sofia |
last post by:
My name is Sofia and I have for many years been running a personals site,
together with my partner, on a non-profit basis. The site is currently not
running due to us emigrating, but during its last year we got traffic of
between 2000 - 2500 unique visitors per day. We are now about to re-launch
the site from Sweden and we need to purchase a script to run it.
Having looked at what is available on the net I have realised that we need a...
|
by: Gregory Nans |
last post by:
hello,
i need some help to 'tree-ify' a string...
for example i have strings such as :
s = """A(here 's , B(A ) silly test) C(to show D(what kind) of stuff i
need))"""
and i need to parse them to have a tree representation such as :
|
by: FRITSCH Vincent |
last post by:
Hi,
i need help on a query.
I've this table :
create table t (
customer number(5),
time date,
status varchar2(1)
|
by: netpurpose |
last post by:
I need to extract data from this table to find the lowest prices of
each product as of today. The product will be listed/grouped by the
name only, discarding the product code - I use SUBSTRING(ProductName,
1, CHARINDEX('(', ProductName)-2).
I can get this result, but I had to use several views (totally
inefficient). I think this can be done in one efficient/fast query,
but I can't think of one.
In the case that one query is not...
|
by: TDM |
last post by:
Hello all,
I suspect I created my own problem as I had a need to install an older
version of MSDN Library so now my .NET Documentation is broken.
When I run :
Start/All Programs/Microsoft Visual Studio .NET/Microsoft Visual Studio .NET
Documentation
All I get is a blank IDE with this text :
| |
by: xunling |
last post by:
i have a question about answering ..... this topic is "need help"
what do i have to write at te topic line, !after i have klicked the
"answer message" button
ive tried many possibilities, all dont work
"Re:" need help
"Re:need help"
|
by: karizmatrix22 |
last post by:
Hi,
I need a programmer who can write 3 programs for following questions below.Programs need to be ready before nextweek.thank you. Person who help me these 3 questions will be get paid.. I am new to programming, thats why i need help..i dont understand any coding at all.
Question 1:
Write an application that accepts a user’s password from the keyboard. When the entered password is less than six characters, more than ten characters, or...
|
by: SanjaiGandhi |
last post by:
Hi ...i am new to programing....pls help to overcome this program..
The Program is..:
if a = 557..using for loop or while or dowhile ..we have to get the
answer for 5+5+7..that is what ever numbers we entered to a..that
should be added..
for eg if a = 34 the answe should be 7 that is 3+4
using % and / we can solve this problem..pls help me to get the
problems
|
by: =?Utf-8?B?am9lb2ppaA==?= |
last post by:
Most students do not have enough time to do their homeworks, assignments,
college papers, etc alone. Also most of them, even though they know what to
do with respect to their writing assignment, find it very hard to overcome
the inertia and hence can't just get started. Besides, Maths problems are
always a source of worries and nightmares to the majority of students. Hence
most students need an academic mentor who can help them...
|
by: jhaydon |
last post by:
First of all, I'm not a CSS expert. If I was, I wouldn't need to be posting for help here. Secondly, I have been doing web design for several years, just not css. Thirdly, I need help and hope someone who knows how to help a person without making them feel like they are a complete idiot can help me.
I need to know how to code a nav/menu bar (or whatever you want to call it) in a css template so that it works in IE. It works in Firefox,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |