|
-
Jun 27th, 2006, 07:42 PM
#1
Thread Starter
Addicted Member
String and symbol issues !?
Ok all I want to do is take the url for the browser and do a search string on it...simple enough right!? ... HA! ... No I’m not that lucky lol ...seams when I try to use "¬" or any symbol in my url string asp.net can't find it. You see I’m calling my asp page url and adding some parameters to the url which the page takes, dose some working out with and passes back a result, but because I’m passing more then 1 parameter to the url I need to separate the parameters out with a symbol like ¬ which is not commonly used as the parameters I’m passing may contain all other symbols like ? and etc…
When I do :
Code:
Dim myURL As String = Request.Url.ToString()
MsgBox(myURL)
Im not getting the symbols back !?
my code:
Code:
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' check page isn't been post back from form event procedures
Try
'Get the URL
'the url would look something like :
' http://localhost:3973/Projects/RegularExpressionValidator.aspx?Value1¬Value2¬
Dim myURL As String = New String(Request.Url.ToString())
'Does the URL contain parameters?
Dim FirstParameterStart As Integer = myURL.IndexOf("?")
Dim FirstParameterEnd As Integer = myURL.IndexOf("¬")
Dim FirstParameter As String = ""
Dim SecondParameter As String = ""
FirstParameterStart = FirstParameterStart + 1
'If the URL has parameters, then get them. If not, return a blank string
If FirstParameterStart > 0 and Then
' Get the first Parameter
FirstParameter = myURL.Substring(FirstParameterStart, FirstParameterEnd - 1)
' Get the second Parameter
SecondParameter = myURL.Substring(FirstParameterEnd + 1, myURL.LastIndexOf("¬") - 1)
End If
' When tracing the ulr i get back :
' http://localhost:3973/Projects/RegularExpressionValidator.aspx?Value1Value2
' and NOT :
' http://localhost:3973/Projects/RegularExpressionValidator.aspx?Value1¬Value2¬
MsgBox(myURL.ToString())
Catch ex As Exception
MsgBox(ex.Message.ToString())
End Try
End Sub
Any help welcome

I will wait for death with a smile and a big stick
-
Jun 27th, 2006, 11:58 PM
#2
Re: String and symbol issues !?
Use URL encode and URL decode.
HTH
HoraShadow
I do like the reward system. If you find that my post was useful, rate it.
-
Jun 28th, 2006, 06:19 AM
#3
Thread Starter
Addicted Member

I will wait for death with a smile and a big stick
-
Jun 28th, 2006, 04:20 PM
#4
Re: String and symbol issues !?
What does regex have to do with it? If you're looking for a 'reserved' regex character, you can simply escape it using \. Example, if you want to search for \, use \\.
Why do you want to use odd characters in the querystring anyways?
-
Jun 28th, 2006, 06:48 PM
#5
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|