473,465 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

HTTP Post Doesnt work in ASP.NET page

Hi All,

I need help again .....

I have an asp.net web page which I hit using the "HTTP POST" method.

My ASP.NET page is a basic hello world example with the following code:

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("Hello World");
Response.End();
}
Then I use a C# desktop application to HTTP POST some data to this web
site. I use the following code to post data:

System.Net.WebRequest req =
System.Net.WebRequest.Create("http://localhost/proj/page.aspx");
req.Timeout = 20000; //timeout = 20 secnds.

//Add these, as we're doing a POST
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
//We need to count how many bytes we're sending.
byte [] bytes =
HttpUtility.UrlEncodeToBytes(Parameters,System.Tex t.ASCIIEncoding.ASCII);//System.Text.Encoding.ASCII.GetBytes(DATA);
req.ContentLength = bytes.Length;
System.IO.Stream os = req.GetRequestStream ();
os.Write (bytes, 0, bytes.Length); //Push it out there
os.Close ();
System.Net.WebResponse resp = req.GetResponse();

My application works perfectly fine on our test servers and a couple of
customer sites , but Im having a problem with one customer, my HTTP
POST messages return the '500 - Internal Server Error'.
And when I browse to the url using internet explorer, I dont get that
error.
So it seems like HTTP GET is working, but HTTP POST does not.

Does anybody have any ideas about what could be wrong here. Is there
some setting that I need to fix in the IIS manager or the security
policies?

Please Help !!!!

Dec 5 '06 #1
1 2586
When I try to POST to the site, this is the exception that i get in my
desktop HTTP Post application:

System.Net.WebException
"The remote server returned an error: (500) Internal Server Error."

I have complete access to the customer web server, can u tell me how
can I check what sort of exception is being generated on the customer
server?
Ciaran O''Donnell wrote:
The site probably expects some sort of post data when posted to and doesnt
handle not getting. Cant you speak to the customer to ask them what the
exception was?
--
Ciaran O'Donnell
http://wannabedeveloper.spaces.live.com
"Arfeen" wrote:
Hi All,

I need help again .....

I have an asp.net web page which I hit using the "HTTP POST" method.

My ASP.NET page is a basic hello world example with the following code:

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("Hello World");
Response.End();
}
Then I use a C# desktop application to HTTP POST some data to this web
site. I use the following code to post data:

System.Net.WebRequest req =
System.Net.WebRequest.Create("http://localhost/proj/page.aspx");
req.Timeout = 20000; //timeout = 20 secnds.

//Add these, as we're doing a POST
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
//We need to count how many bytes we're sending.
byte [] bytes =
HttpUtility.UrlEncodeToBytes(Parameters,System.Tex t.ASCIIEncoding.ASCII);//System.Text.Encoding.ASCII.GetBytes(DATA);
req.ContentLength = bytes.Length;
System.IO.Stream os = req.GetRequestStream ();
os.Write (bytes, 0, bytes.Length); //Push it out there
os.Close ();
System.Net.WebResponse resp = req.GetResponse();

My application works perfectly fine on our test servers and a couple of
customer sites , but Im having a problem with one customer, my HTTP
POST messages return the '500 - Internal Server Error'.
And when I browse to the url using internet explorer, I dont get that
error.
So it seems like HTTP GET is working, but HTTP POST does not.

Does anybody have any ideas about what could be wrong here. Is there
some setting that I need to fix in the IIS manager or the security
policies?

Please Help !!!!
Dec 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Danny | last post by:
Hi I am trying to create links to my product pages that are genereated via cgi. The best way seems to use the search.cgi script that is used when somebody enters a search term in the websites...
6
by: Phillip N Rounds | last post by:
I have a webform, from which I have to submit info to another site. Their instructions are to have a html form, with the following as the submit: <form method="post"...
3
by: accyboy1981 | last post by:
Hi, I am currently designing an HTML page with a form with a post method. The page is calling itself so with the details that are passed will vary how the page will look i.e. number of results...
3
by: Clouds | last post by:
Hi ! How do I add the dynamic event handler for a dropdownlist present in the itemtemplate of a datalist !! I am doing it in the itemdatabound event of the datalist but it doesnt work... I am...
3
by: Bruno Paquette | last post by:
I have installed visual studio .net and now i started to write the first few examples from the 70-315 book by Kalani. It looks like all server side code that i put between <% %> doesnt process...
3
by: Eric | last post by:
I'm trying to test code to post xml to a web page in anticipation of a new project. I wanted to try a simple test first, but I get a (405) Method Not Allowed error no matter what I try. I have...
3
by: cheecs | last post by:
Hi everyone, I'm really stuck in this problem. my problem is Im converting the existing project which is using querystring and I need to change it to POST. At the moment when clicking on submit...
7
by: php_mysql_beginer911 | last post by:
Hi .. hope someone will help i am trying to figure it out why i cannot post string "union select" every time i try to post data which content union and select .. the page doesn't get posted and...
3
by: Tahir | last post by:
Hi, i am delevoping an ASP.NET website which worked well on my old web host and now working on localhost but now it doesnt works on my new host. i have new registered and ftp the files that...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.