473,289 Members | 2,040 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

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 2584
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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.