Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP.NET
<form action="FileUploadHandler.ashx" method="post">
        <input type="hidden" name="pp" id="pp" value="root" runat="server" />
    </form>
i have this html code and i need to access the hidden element in my handler

What I have tried:

i have tried this but return null value always

NameValueCollection nvc = content.Request.Form;

                        string name = nvc["pp"];
Posted
Updated 27-Sep-17 5:52am
v2

Did you mean context rather than content?

NameValueCollection nvc = context.Request.Form;
 
Share this answer
 
Your <input> has runat="server", but your <form> does not.

Either your page will return an exception indicating that the control must be placed inside a form tag with runat="server"; or the <form> tag you've shown is nested inside an existing server form.

Nested forms are not valid or supported. Their behaviour is undefined; they might sort-of work in some browsers, but that is subject to change at any time.

Note: It's strictly forbidden to nest a form inside another form. Nesting can cause forms to behave in an unpredictable manner based on the browser that is being used.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900