how to decode a url in vb.net

无人久伴 提交于 2019-12-31 01:54:12

问题


This line says server is not declared.

Dim DecodedString As String = server.UrlDecode(context.Request.Form("DeckName"))

I have imports system.web at the top. cannot seem to figure out why its not working.


回答1:


Use HttpUtility instead.

Dim decodedUrl As String = HttpUtility.UrlDecode(encodedUrl)

More details here:
http://msdn.microsoft.com/en-us/library/system.web.httputility.urldecode.aspx




回答2:


This is old and K3N already provided a great answer.. but I believe the 's' in 'server' should be capitalized in your code. That may have been the issue.




回答3:


Imports System.Net

Dim DecodedString As String = WebUtility.UrlDecode(context.Request.Form("DeckName"))

This should work for vb.net. I tried the HttpUtility but it doesn't recognize even i imported System.Web.



来源:https://stackoverflow.com/questions/14350192/how-to-decode-a-url-in-vb-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!