Visual Studio .NET - Encode URL in asp net 2 0

Asked By abc V
04-Nov-05 10:52 AM
Hi all,

I was wondering how do i encode the URL in asp.net does it need any decoding again coz the flow of the aspx pages depends on the Qery strings sent. Thanks in advance. All help is great help.

--RAdhika.

An example  An example

04-Nov-05 11:00 AM
string str="Cat&Dog";
			Response.Redirect("WebForm1.aspx?str="+Server.UrlEncode(str));

In webForm1, you can access Cat&Dog as 

Response.Write(Server.UrlDecode(Request.QueryString["str"]));

HttpUtility UrlEncode  HttpUtility UrlEncode

04-Nov-05 11:03 AM
Hi Radhika,

You can use the HttpUtility.UrlEncode to encode your query string, as follows:

Dim query As String = "City=" & _
         HttpUtility.UrlEncode(txtCity.Text)
   query += "&Hotel=" & _
         HttpUtility.UrlEncode(txtHotel.Text)
   query += "&Date=" & _
         HttpUtility.UrlEncode(txtDate.Text)
   query += "&NumberDays=" & _
         HttpUtility.UrlEncode(txtNumberDays.Text)
   Response.Redirect("Reservation1.aspx?" + query)

Hope this helps.

URL Encode Links  URL Encode Links

04-Nov-05 11:04 AM
Hi Radhika,

Here's a couple of links regarding URL encode:

http://www.informit.com/articles/article.asp?p=28502&seqNum=4&rl=1
http://www.aspnetresources.com/blog/encoding_forms.aspx

Hope this helps.
URL Encode  URL Encode
05-Nov-05 10:01 AM
have a look at these

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebHttpServerUtilityClassUrlEncodeTopic1.asp

http://www.w3schools.com/asp/met_urlencode.asp

thanks
Create New Account
help
Visual Studio .net .NET Framework Hi NG, ich habe vor längerer Zeit mit Visual Studio .Net 2003 gearbeitet und überlege momentan auf einen neueren Stand upzudaten. Ein Visual Studio .Net 2008 scheint es nicht zu geben. Habe zumindest mit googeln nichts gefunden. Was
Wise for Visual Studio.NET Wise for Visual Studio.NET By Peter A. Bromberg, Ph.D. To "Print This Page" Link Peter Bromberg Wise for Visual Studio .NET is a total and complete installation development system for creating and editing Windows® Installer
Visual Studio versioning . . . . how to tell? .NET Framework To my knowledge, Visual studio 6 was released in 1998, then Visual Studio .NET 2002 is VS 7, then Visual Studio .NET 2003 is VS 7.1, then Visual
visual studio.net 2003 and Access 2007 database .NET Framework Hi I am currently using Visual Studio.Net 2003 running on Windows Server 2000 operating system. I have used Visual Studio.net 2003 connecting to Access 2002 databases in the pass with great success. Now
Is Visual Studio self-hosting ? .NET Framework Does Microsoft use Visual Studio IDE, Visual Studio Debugger, Visual Studio Linker and Visual Studio compiler for developing Visual Studio ? Or is Visual Studio not