ASP.NET and the name are 3 words?

zhaozj2021-02-16  101

Recently, I have been doing an academic system, and I need to pass the teacher name through the URL, I found a strange problem in the test. If the teacher name is 2 words, there is no problem, if it is the use of Request ("teachername") At the time of one word, do you say that .NET and name are 3 words? Depressed (I am also the name of 3 words) ...

Depressed for 5 seconds, I thought of Urlencode's big fairy, so Server.urlencode (Teachername), MMD, the problem is still depressed ...

So the "Why" era people's style - asked colleagues, colleagues also felt strange, but provided a valuable clue, Urlencode's big fairy has 2 home, and one is httputility, I checked MSDN, I found out that it is like this. Urlencode is a member of the two objects: httpserverutility and httputility, and the method and attribute of the HTTPServerUtility class is disclosed through the internal Server object of ASP.NET.

Holding the last trust of .NET, I tried httputility.urlencode, Faint, really OK.

The problem is solved, leaving 2 doubts:

2 words and 3 words have any difference between httpserverutility and httputility in the call mechanism (only httpserverity on the MSDN is a HELPER method for processing the web request, and Httputility provides encoding when processing web requests Method for decoding URLs. I really don't understand)

These two questions will be recorded, and they left a space study, and I hope that the master will enlighten me!

转载请注明原文地址:https://www.9cbs.com/read-10332.html

New Post(0)