QueryString - WeOnlyDo Discussion board

QueryString (General questions)

by Pedro A., Monday, August 02, 2004, 04:58 (7201 days ago)

Hi,
Continuing with my experiments, I've realized that when you select more than one value in a list, the querystring wrapper splits those values in several objects with the same name. I mean, when you send something like this:
http://server:port/page.htm?values=3,12,4,5
as the result from a multiple selection in a list box, the library creates as many User.Request.QueryString( values ) as values in the string (4 in this case).
Would it be possible to recover them as a single comma separated string, or I may parse it manually?
Thanks

Re: QueryString

by wodSupport, Monday, August 02, 2004, 12:15 (7200 days ago) @ Pedro A.

Pedro,

QueryString should ease up your life - so this shouldn't be done manually. Let me try it, I'll get back to you.

Re: QueryString

by wodSupport, Monday, August 02, 2004, 17:06 (7200 days ago) @ wodSupport

P.,

I think I misunderstood you. You actually asked if something like

something.html?posted=1,2,3,4

could be parsed to 4 separate 'posted' variables, each containing different values '1', '2', '3', and '4'? If so, currently wodWebServer will not do this for you. If you think about it, it makes sense - value of 'posted' is '1,2,3,4' and this is what you'll get. Parsing which you currently require is somehow (at least, I see it that way) typical only for your current needs - this isn't something widespread and I don't think this would be needed by many customers. If we go into parsing values, we can get 1000 new requests for different parsing, right?

Hope you see it the same way as me.

BUT! Let's see if we can somehow suit your needs, and still make some wider approach this, to cover more possible combinations? I'm open to your suggestions on how to improve it to suit your needs, but also to be sort of general solution.

BTW why don't you just use VB's Split statement?

Kreso

Re: QueryString

by Pedro A., Monday, August 02, 2004, 17:19 (7200 days ago) @ wodSupport

It actually parses 1,2,3,4 to 4 separated variables. I need it doesn't do that. I need to say .QueryString( posted ) and get 1,2,3,4 .

Now, the library creates 4 objects posted , each one with a different value:
.QueryString(0).name = posted .QueryString(0).value = 1
.QueryString(0).name = posted .QueryString(0).value = 2
.QueryString(0).name = posted .QueryString(0).value = 3
.QueryString(0).name = posted .QueryString(0).value = 4

And I need only one:
.QueryString(0).name = posted .QueryString(0).value = 1,2,3,4
Because my target is use SPLIT method.

Re: QueryString

by Pedro.A, Monday, August 02, 2004, 17:20 (7200 days ago) @ Pedro A.

The index in QueryString array should change from 0 to 3, sorry

y creates 4 objects posted , each one with a different value:
.QueryString(0).name = posted .QueryString(0).value = 1
.QueryString(0).name = posted .QueryString(0).value = 2
.QueryString(0).name = posted .QueryString(0).value = 3
.QueryString(0).name = posted .QueryString(0).value = 4

Re: QueryString

by wodSupport, Monday, August 02, 2004, 17:22 (7200 days ago) @ Pedro.A

Pedro,

yes, but what if someone actually needs it to be one variable with value '1,2,3,4'? Remember - we need general solution, to specific to your current requirement.

What if someone posts this:

info.html?name=John,Doe

I would parse it your way which would be invalid, and customer would say he wants 'John,Doe' inside the value. Do you see my point?

Kreso

Re: QueryString

by wodSupport, Monday, August 02, 2004, 17:24 (7200 days ago) @ wodSupport

Perhaps I didn't read your reply correctly.

Are you suggesting we return different values in each access to QueryString(0)? We can't do that for many reasons. Variable is a variable - you can change it, we can't.

Can't you just try to use 'Split' statement in your specific problem?

Re: QueryString

by wodSupport, Monday, August 02, 2004, 17:30 (7200 days ago) @ wodSupport

Pedro,

forgive me - I was wrong. We're talking about same thing here! I was unaware wodWebServer would split your variable to 4 different values. If it does that, then this is a bug! Let me check it out, and fix it!

Kreso

Re: QueryString

by payensa, Monday, August 02, 2004, 17:31 (7200 days ago) @ wodSupport

Ok, I'm from Spain and my English could be a little bad, but I'll try to explain once again, because we are saying the same:
I need to get a string with comma separated values, in order to use the split command. I want that wwhole string, as you are suggesting.
But your library is doing a kind of parsing, and it doesn't give me the whole string 1,2,3,4 .
The library is creating 4 different variables. I'm not asking you to do that, you are doing already. Do you understand? Your library is giving me the values in different variables with the same name. I want a single string qith the four values... What you are saying you can't do is what your library just do, and what you are saying I should do is what I want to do!

Re: QueryString

by wodSupport, Monday, August 02, 2004, 17:37 (7200 days ago) @ payensa

I think I understand now, we were on the same 'wave' here.

But I'm unable to duplicate your problem. Here's URL I tried to access:

http://localhost/posted.htm?value=1,2,3,4

and here's code I used:

[code]
Private Sub Http1_RequestDone(ByVal User As WODWEBSERVERCOMLib.IWebUser)
Debug.Print User.Request.QueryVariables.Count
Debug.Print User.Request.QueryVariables(0).ToString
End Sub
[/code]

and results are:

[code]
1
value: 1,2,3,4
[/code]

so it seems to me it does not do any internal parsing.

Can you make sample that shows your problem and send it to [mail=techsupport@weonlydo.com]techsupport@weonlydo.com[/mail]

Kreso

Re: QueryString

by payensa, Monday, August 02, 2004, 17:38 (7200 days ago) @ wodSupport

At last we undersand. [:wink:]

Pedro,

forgive me - I was wrong. We're talking about same thing here! I was unaware wodWebServer would split your variable to 4 different values. If it does that, then this is a bug! Let me check it out, and fix it!

Kreso

Re: QueryString

by wodSupport, Monday, August 02, 2004, 17:45 (7200 days ago) @ payensa

Please look at previous post in this thread in case you missed it - I tried and worked for me. Can you change some of our samples so it shows bad parsing , and send it to me?

Kreso

Re: QueryString

by payensa, Monday, August 02, 2004, 17:52 (7200 days ago) @ wodSupport

index.htm?id=6,7,8,9

[code]Private Sub websrv_RequestDone(ByVal User As WODWEBSERVERCOMLib.WebUser) Handles websrv.RequestDone
Console.Out.WriteLine(User.Request.QueryVariables.Count)
Console.Out.WriteLine(User.Request.QueryVariables( id ).ToString)
End Sub
[/code]

[code]
4
id: 6
[/code]

[code]Private Sub websrv_RequestDone(ByVal User As WODWEBSERVERCOMLib.WebUser) Handles websrv.RequestDone
Console.Out.WriteLine(User.Request.QueryVariables.Count)
Console.Out.WriteLine(User.Request.QueryVariables.ToString)
End Sub
[/code]

[code]
4
id: 6
id: 7
id: 8
id: 9
[/code]


As you can see, I'm using VB.NET.

Re: QueryString

by wodSupport, Monday, August 02, 2004, 23:52 (7200 days ago) @ payensa

I really don't understand. Are we using same version? I just downloaded it from our website and tried using VB.NET, here's my code and results:

[code]Public Class Form1
Inherits System.Windows.Forms.Form

Windows Form Designer generated code

Dim WithEvents Web1 As WODWEBSERVERCOMLib.wodWebServerCom

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Web1 = New WODWEBSERVERCOMLib.wodWebServerCom
Web1.Start()

End Sub

Private Sub Web1_RequestDone(ByVal User As WODWEBSERVERCOMLib.WebUser) Handles Web1.RequestDone
Console.Out.WriteLine(User.Request.QueryVariables.Count)
Console.Out.WriteLine(User.Request.QueryVariables.ToString)
End Sub
End Class

results:
1
id: 6,7,8,9

[/code]

What could be so different in your version than mine? Do you use IE (this should make no difference but...)

Can you add this line (DebugFile is a hidden property)

[code]Web1.DebugFile = c:\debug.txt [/code]

and then send me debug.txt to techsupport@weonlydo.com ?

Thanks,
Kreso