【发布时间】:2016-08-01 12:57:50
【问题描述】:
您好,我正在使用以下代码在 vb 中对 url 进行编码,但我没有得到预期的输出,请帮忙。
Dim CancelURL As String = "http://d41a9833f1464bd0a764b77669049fc8.cloudapp.net/Login/Appointment Booking/CancelAppointment.aspx?" &
"clhid=" & objLogin.LoggedHeadOrgID &
"&apptid=" & objAppt.ID
strTemplateString = strTemplateString.Replace("[Cancellation link]", Uri.EscapeDataString(CancelURL))
这是我的代码,我最终得到了这个
http%3A%2F%2Fd41a9833f1464bd0a764b77669049fc8.cloudapp.net%2FLogin%2FAppointment%20Booking%2FCancelAppointment.aspx%3Fclhid%3D22b53721-a127-41be-95ca-7512b5caad84%26apptid%3Debb09af1-c521-47d6-9a7d-0b411ef3937d
但我期待
http://d41a9833f1464bd0a764b77669049fc8.cloudapp.net/Login/Appointment Booking/CancelAppointment.aspx?clhid=3D22b53721-a127-41be-95ca-7512b5caad84&apptid=Debb09af1-c521-47d6-9a7d-0b411ef3937d
【问题讨论】:
-
为什么不是预期的输出?您的预期输出是什么是?
-
不要在 cmets 部分发布实质性澄清;相反,更新您的问题。您需要在问题本身中包含所有相关信息。
-
那么不要对主机名进行 URLEncode。
-
@roryap 感谢您的建议,将立即进行
标签: .net vb.net url uri urlencode