| |

VerySource

 Forgot password?
 Register
Search
View: 621|Reply: 5

anxious! Problems passing parameters between pages? ? ? ?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-8 21:30:01
| Show all posts |Read mode
Page a.htm above code
<a href="websites/Result.aspx?&FromCity='Shihezi'&ToCity='Turfan'"> asdfsdafsdafsadfsda </a>
Page b.aspx background code
string fromCity = Request.QueryString ["FromCity"];
string toCity = Request.QueryString ["ToCity"];
string weight = Request.QueryString ["Weight"];

Why did you get Shihe? Turu? The last word of the parameter "child" and "fan" both become "?"

If the parameter is "Hello China", "Hello World", there is no problem
Reply

Use magic Report

0

Threads

24

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-4-1 13:45:01
| Show all posts
Try Server.Ulrencode and server.Urldecode

<a href="websites/Result.aspx?&FromCity=Server.UrlEncode("Shihezi")&ToCity=Server.UrlEncode("吐鲁番")">

 The above code is not guaranteed to be written correctly. Please LZ try it yourself

Then when receiving, server.urldecode
Reply

Use magic Report

0

Threads

23

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-4-1 17:00:02
| Show all posts
Using session, using Chinese as a parameter is problematic
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 United States

Post time: 2020-4-2 23:30:02
| Show all posts
sulfuresser
Should be right, mainly coding issues
Reply

Use magic Report

3

Threads

29

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-4-3 14:30:01
| Show all posts
(1) Do not add single quotes
(2) Use escape encoding
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-4-4 10:00:02
| Show all posts
It has been solved, the encoding problem can be encoded with encodeURI ()
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