| |

VerySource

 Forgot password?
 Register
Search
View: 788|Reply: 6

Problems setting post and get

[Copy link]

2

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-6 19:00:01
| Show all posts |Read mode
I did it in the middle of the night
Stuck on POST GET

The book says to use the form FORM and then select POST or GET to submit

I used the input information TEXTBOX with a WEB control and no form. Can I directly set to submit using POST or GET
How to set it up?
My novice procedure is as follows
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub TextBox2_TextChanged (ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

    End Sub

    Protected Sub TextBox1_TextChanged (ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Protected Sub Button1_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click


        If Page.IsValid Then
            If RadioButton1.Checked = True Then
                Request.HttpMethod == "POST"
// This is the place I do n’t understand. He said that it ’s read-only


            Else
                Request.HttpMethod == "get"

            End If
            Response.Write ("User name:" + TextBox1.Text + "<br>" + "Student number:" + TextBox2.Text + "<br>" + "Real name:" + TextBox3.Text + "<br> "+" Password: "+ TextBox4.Text +" <br> "+" dormitory phone: "+ TextBox5.Text +" <br> "+" mobile phone: "+ TextBox6.Text +" <br> "+" Email: "+ TextBox7.Text +" <br> "+" Profile: ")

        End If
    End Sub
Reply

Use magic Report

0

Threads

23

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-1-7 02:45:01
| Show all posts
Setting Form Properties
Reply

Use magic Report

0

Threads

8

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-7 09:45:01
| Show all posts
Server Form is always submitted by POST, no matter how you set it.
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-7 15:09:01
| Show all posts
learning. . .
Reply

Use magic Report

0

Threads

73

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-7 15:18:01
| Show all posts
If you have to use the GET method, then those SERVER controls cannot be used directly. You can only use Request.QueryString to get them, and all submitted values ​​follow the URL.
Reply

Use magic Report

0

Threads

73

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-7 16:00:02
| Show all posts
Don't think about this POST problem when you learn ASP.NET. ASP.NET submits by default.
If you must use GET, then do the following, do not add Runat = Server
<form method = get>

<form method = post>
Reply

Use magic Report

2

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-8 10:54:01
| Show all posts
Got used this statement
Protected Sub Button1_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click


        If Page.IsValid Then
            If RadioButton1.Checked = True Then
                Dim f As New HtmlForm
                Page.FindControl ("form1")
                f.Method = "post"
                Response.Write ("Use POST to process username:" + TextBox1.Text + "<br>" + "Student ID:" + TextBox2.Text + "<br>" + "Real name:" + TextBox3.Text + "<br>" + "Password:" + TextBox4.Text + "<br>" + "dormitory phone:" + TextBox5.Text + "<br>" + "mobile phone:" + TextBox6.Text + "< br> "+" Email: "+ TextBox7.Text +" <br> "+" Profile: ")

            Else
                Dim f As New HtmlForm
                Page.FindControl ("form1")
                f.Method = "get"
                Response.Write ("Use GET to process username:" + TextBox1.Text + "<br>" + "Student ID:" + TextBox2.Text + "<br>" + "Real name:" + TextBox3.Text + "<br>" + "Password:" + TextBox4.Text + "<br>" + "dormitory phone:" + TextBox5.Text + "<br>" + "mobile phone:" + TextBox6.Text + "< br> "+" Email: "+ TextBox7.Text +" <br> "+" Profile: ")


            End If
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list