2016-08-01 36 views
1

Hallo Ich benutze den folgenden Code für die Codierung einer URL in Vb, aber ich bekomme nicht die erwartete Ausgabe bitte helfen.vb UrlEncoding funktioniert nicht

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)) 

dies ist mein Code und ich landete mit diesem

http%3A%2F%2Fd41a9833f1464bd0a764b77669049fc8.cloudapp.net%2FLogin%2FAppointment%20Booking%2FCancelAppointment.aspx%3Fclhid%3D22b53721-a127-41be-95ca-7512b5caad84%26apptid%3Debb09af1-c521-47d6-9a7d-0b411ef3937d 

Aber ich erwarte

http://d41a9833f1464bd0a764b77669049fc8.cloudapp.net/Login/Appointment Booking/CancelAppointment.aspx?clhid=3D22b53721-a127-41be-95ca-7512b5caad84&apptid=Debb09af1-c521-47d6-9a7d-0b411ef3937d 
+0

Warum ist das nicht die erwartete Ausgabe? Was * ist * deine erwartete Ausgabe? –

+0

ich brauche http://d41a9833f1464bd0a764b77669049fc8.cloudapp.net/Login/Appointment%20Booking/CancelAppointment.aspx?clhid=somevalue wie diese – Tanmay

+3

Veröffentlichen Sie keine wesentlichen Klarstellungen im Kommentarbereich; Aktualisieren Sie stattdessen Ihre Frage. Sie müssen alle relevanten Informationen in die Frage selbst aufnehmen. –

Antwort

0

Sie müssen Uri.EscapeUriString, da dies entkommen nicht die Schema:

Uri.EscapeUriString("http://foo.com/this is a url") 

'output 
http://foo.com/this%20is%20a%20url 
Verwandte Themen