By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,050 Members | 1,148 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,050 IT Pros & Developers. It's quick & easy.

Handling Post Request

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.