Passing null values in a Querystring

  • Thread starter Thread starter axapta
  • Start date Start date
A

axapta

Hi Group,
I'm not sure if there's a limit to the amount of parameters you can pass
between pages.
I'm trying to pass 9 as follows:

strRedirect = "PlacementHistory.aspx" & _
"?hlscaseno=" & Me.txtHLSCaseNo.Text.ToString & _
"&SeqNo=" & Me.txtseqno.Text.ToString & _
"&type=" & Me.txtType.Text.ToString & _
"&regno=" & Me.txtRegNo.Text.ToString & _
"&allocode=" & Me.txtAllocCode.Text.ToString & _
"&hlsstatus=" & Me.txtHLSStatus.Text.ToString & _
"&accomno=" & Me.txtaccomno.Text.ToString & _
"&roomno=" & Me.txtroomno.Text.ToString & _
"&letter=" & Me.txtletter.Text.ToString & _
"&startdate=" & Me.txtstarteddate.Text.ToString & _
"&name=" & Me.txtName.Text.ToString & _
"&propid=" & Me.txtpropid.Text.ToString


Server.Transfer(strRedirect)
However, I receive the following error:
Invalid path for child request
'PlacementHistory.aspx?hlscaseno=22238&SeqNo=1&type=hlshotel&regno=0&allocode=&hlsstatus=CLOS&accomno=2&roomno=2&letter=
&startdate=01/07/2005 09:11:31&name=UNKNOWN WILKINSON&propid= '. A virtual
path is expected.


TIA
 
axapta said:
Hi Group,
I'm not sure if there's a limit to the amount of parameters you can pass
between pages.
I'm trying to pass 9 as follows:

strRedirect = "PlacementHistory.aspx" & _
"?hlscaseno=" & Me.txtHLSCaseNo.Text.ToString & _
"&SeqNo=" & Me.txtseqno.Text.ToString & _
"&type=" & Me.txtType.Text.ToString & _
"&regno=" & Me.txtRegNo.Text.ToString & _
"&allocode=" & Me.txtAllocCode.Text.ToString & _
"&hlsstatus=" & Me.txtHLSStatus.Text.ToString & _
"&accomno=" & Me.txtaccomno.Text.ToString & _
"&roomno=" & Me.txtroomno.Text.ToString & _
"&letter=" & Me.txtletter.Text.ToString & _
"&startdate=" & Me.txtstarteddate.Text.ToString & _
"&name=" & Me.txtName.Text.ToString & _
"&propid=" & Me.txtpropid.Text.ToString


Server.Transfer(strRedirect)
However, I receive the following error:
Invalid path for child request
'PlacementHistory.aspx?hlscaseno=22238&SeqNo=1&type=hlshotel&regno=0&allocode=&hlsstatus=CLOS&accomno=2&roomno=2&letter=
&startdate=01/07/2005 09:11:31&name=UNKNOWN WILKINSON&propid= '. A
virtual path is expected.


TIA

The date and name values contains characters that are invalid in an url,
so you have to url encode the values:

"&startdate=" & Server.UrlEncode(Me.txtstarteddate.Text.ToString) & _
"&name=" & Server.UrlEncode(Me.txtName.Text.ToString) & _

Actually, you should url encode any value that possibly may contain
characters that are not completely safe.


Also, I think that you have to specify that the current QuesryString and
Form collections should be cleared to specify a new query string:

Server.Transfer(strRedirect, false)


The limit to what you can put in an url, is in the length that the
browser can handle. The buffer used for the url is usually something
like 2kB or 4kB. If you keep it below a thousand characters, you will be
safe.

However, when you are using Server.Transfer, the url doesn't make a
round trip to the browser, so you could probably put a bit more in the
query string before you reach any limit. You should probably try to keep
it reasonably small anyhow.
 
Back
Top