简体   繁体   中英

Can the code within a <script runat=server> read form values which are posted by a form which doesn't have runat=server attribute?

I want to post a form on html and process the variables with asp.net code, like writing a php code. do I have to use <% %> or can I create an empty file with

<script runat=server>

</script>

You just need to get the postback values using the Request.Form.

This exposes all the input values in properties.

Look at this:

HttpRequest.Form

If you have an iput with id "name", you can read the user input like so:

  Request.Form["name"]

The result is always a string, so that you'll need to parse it to convert it to another data type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM