Saturday, March 31, 2012

the asp.net equivalent of the "Request.Form" in asp

i am having problems with a simple web service i am creating in asp.net using C#. does anybody know what Request.Form is in asp.net.
cheers
much appreciatedI've never done classic ASP code, but I think what you're looking for is Request.Params[]

Should still be Request.Form. What is the problem that you are having?


Hi,
Request.Form method was used in classic ASP(3.0)
<form action="hello.aspx" method="post">
Your name: <input type="text" name="fname" size="20">
<input type="submit" value="Submit">
</form>
<%
dim fname
fname=Request.Form("fname")
Response.Write("Hello " & fname)
%>
As in Asp.net forms are posted to itself So Request.Form was not actively used in asp.net.
Iam still now able to understand why you require this in web services.


You can still use Request.Form, but you'll have to make sure the value exists before trying to use it. In Classic ASP, if the value didn't exist it would return an empty string, but in ASP.NET you get Nothing (in VB.NET, which I believe is null in C#).

0 comments:

Post a Comment