473,320 Members | 1,883 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,320 software developers and data experts.

Handling Post Request

I have to create a page that all it does it handle a 'POST' request with
some parameters

So I created a blank page and in the Load event I try to handle the
parameters passed but the page doesn't open it and returns some error

Any suggestions?

Samuel
Nov 15 '06 #1
2 6330
What error does it return? It's really hard to know what is going on without
knowing the error.

To handle post items, you would access them through the Request.Form
collection. What you'll need to do though is always test to ensure that the
form collection item is not null before you access it. If it's null you'll
get an error. In C# it would look like this.

string myVariable = string.Empty;

if(Request.Form["myvariable"] != null)
{
myVariable = Request.Form["myvariable"].ToString();
}

Keep in mind that all items are strings that are passed in since they are
all text. If it's another type, such as integer, you'll have to convert it
yourself. An example of an integer is (of course, still check to see if the
form field is null first):

int myVariable = Convert.ToInt32(Request.Form["myvariable"].ToString());
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:eF**************@TK2MSFTNGP02.phx.gbl...
>I have to create a page that all it does it handle a 'POST' request with
some parameters

So I created a blank page and in the Load event I try to handle the
parameters passed but the page doesn't open it and returns some error

Any suggestions?

Samuel

Nov 15 '06 #2
it was a security problem
thank you,
samuel

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:uG**************@TK2MSFTNGP02.phx.gbl...
What error does it return? It's really hard to know what is going on
without knowing the error.

To handle post items, you would access them through the Request.Form
collection. What you'll need to do though is always test to ensure that
the form collection item is not null before you access it. If it's null
you'll get an error. In C# it would look like this.

string myVariable = string.Empty;

if(Request.Form["myvariable"] != null)
{
myVariable = Request.Form["myvariable"].ToString();
}

Keep in mind that all items are strings that are passed in since they are
all text. If it's another type, such as integer, you'll have to convert it
yourself. An example of an integer is (of course, still check to see if
the form field is null first):

int myVariable = Convert.ToInt32(Request.Form["myvariable"].ToString());
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:eF**************@TK2MSFTNGP02.phx.gbl...
>>I have to create a page that all it does it handle a 'POST' request with
some parameters

So I created a blank page and in the Load event I try to handle the
parameters passed but the page doesn't open it and returns some error

Any suggestions?

Samuel


Nov 15 '06 #3

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

Similar topics

4
by: Pavils Jurjans | last post by:
Hallo, I am working on multilingual web-application, and I have to be very sure about how the international characters are encoded and decoded in the client-server form requests. There's a...
3
by: reneeccwest | last post by:
How can I simulate HTTP post request by JavaScript? When I select from <SELECT> combo box. onClick will call JavaScript function. I want this function to send HTTP POST request with the selected...
2
by: Robert Oschler | last post by:
I am working on a PHP 4 app that interacts with an external authorization server. The external server does "third-party" authorization of users. So I do the following: 1) Each of my PHP scripts...
4
by: James Johnson | last post by:
Dear C#Dex, I am trying to automate a POST to a web page that clicks a button. I have been able to hit a target web page and run the web page. However, the button on the page does not click. ...
7
by: tshad | last post by:
I have been trying to solve this problem for a while now and have it narrowed down. I am on an XP SP2 trying to run ASP.NET. The page I can't seem to get to work is: <%@ Page Language="VB"...
6
by: Clif | last post by:
Hi, I would like to find out exactly what is being sent when a web page uses the post request method. My thought was to use the webbrowser control together with the HTTPWebRequest class, but am...
4
by: figelwump | last post by:
All, I am writing an HTTP 1.1 compliant proxy in c#.NET, for use as a proxy server for any web browser (IE, firefox, etc). I've got it working fine for GET requests. However, when a POST...
2
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata ...
6
by: 703designs | last post by:
I'm writing a little Drupal module that implements a couple forms, relaying the submitted values to a third-party site. I know the target URL and I have all of the values that I want to submit with...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.