473,769 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Empty parameters in a asp .net (vb) page query string

Hi,
I am trying to populate 3 paramters in an asp .net (vb) page redirect,
the first one is ok ok and gets populated by the other two get inserted into
the url for the redirect as empty strings! Anyone got any clues?? The code
is below and I have checked that the variables beginning with "g_str" are
all populated before the code is called. I think its something to do with
the "&" in the "&Title" and "&Version", do I need to do something to
those???

Cheers
Paul

Dim strVal_1 as string
Dim strVal_2 as string
Dim strVal_3 as string

strVal_1= "?SQL=" & g_strSQL
strVal_2= "&Title=" + g_strTitle
strVal_3= "&Version=" + g_strVersion

Response.Redire ct("http://localhost/misc/frmEntry.aspx?E rror=" & strVal_1 &
strVal_2 & strVal_3)
Jul 19 '05 #1
3 4962
Paul...I'm not sure but when you step through it in the debugger, I'm
assuming all the assignement are done correctl ( ie strVal_1, strVal_2 and
strVal3)

Try this...

Dim sb as New System.Text.Str ingbuilder
sb.Append("http ://localhost/misc/frmEntry.aspx?E rror=")
sb.Append("?SQL =" & strSQL)
sb.Append("&Tit le=" & g_strTitle)
sb.Append("&Ver sion=" & g_strVersion)
'Put breakpoint here to make sure redirect is what you want in it's
entirety - in the command window ?sb.ToSTring

Response.Redire ct(sb.ToSTring)

It looks like the + might be the cause of improper string concatenation. In
either case, even if you don't use a stringbuilder, just add on all
concatenations with the line continue character _ b/c as it stands now,
you're creating at a minimum 3 string objects when one would do. (This
isn't the problem you are referring to, but it's just a suggestion for
efficiency's sake.)

Let me know if the full query string is getting populated correctly and if
so, we'll try to narrow it down from there.

Good Luck,

Bill

"Paul M." <pa**@nospam.fs net.co.uk> wrote in message
news:bi******** **@news6.svr.po l.co.uk...
Hi,
I am trying to populate 3 paramters in an asp .net (vb) page redirect,
the first one is ok ok and gets populated by the other two get inserted into the url for the redirect as empty strings! Anyone got any clues?? The code
is below and I have checked that the variables beginning with "g_str" are
all populated before the code is called. I think its something to do with
the "&" in the "&Title" and "&Version", do I need to do something to
those???

Cheers
Paul

Dim strVal_1 as string
Dim strVal_2 as string
Dim strVal_3 as string

strVal_1= "?SQL=" & g_strSQL
strVal_2= "&Title=" + g_strTitle
strVal_3= "&Version=" + g_strVersion

Response.Redire ct("http://localhost/misc/frmEntry.aspx?E rror=" & strVal_1 & strVal_2 & strVal_3)

Jul 19 '05 #2
"Paul M." <pa**@nospam.fs net.co.uk> wrote in message
news:bi******** **@news6.svr.po l.co.uk...
Hi,
I am trying to populate 3 paramters in an asp .net (vb) page redirect,
the first one is ok ok and gets populated by the other two get inserted into the url for the redirect as empty strings! Anyone got any clues?? The code
is below and I have checked that the variables beginning with "g_str" are
all populated before the code is called. I think its something to do with
the "&" in the "&Title" and "&Version", do I need to do something to
those???

Dim strVal_1 as string
Dim strVal_2 as string
Dim strVal_3 as string

strVal_1= "?SQL=" & g_strSQL
strVal_2= "&Title=" + g_strTitle
strVal_3= "&Version=" + g_strVersion

Response.Redire ct("http://localhost/misc/frmEntry.aspx?E rror=" & strVal_1 & strVal_2 & strVal_3)

Consider the resulting url :
http://.../frmEntry.aspx?E rror=?SQL={valu e of g_strsql}&Title ={value of
g_strtitle}&Ver sion={value of g_strVersion}
The ? (Question mark) is used to separate the script name (ie: aspx page)
and the parameters and as you can see there are two question marks, thus
your url is malformed and the risk of a partial interpretation is high.
I don't know what is the purpose of the Error parameter, either it contains
all error fields or it is useless:
http://.../frmEntry.aspx?E rror=?{value of g_strsql};{valu e of
g_strtitle};{va lue of g_strVersion}
In this url there is only one parameter: Error, then you have to split its
value to get error details.
http://.../frmEntry.aspx?S QL={value of g_strsql}&Title ={value of
g_strtitle}&Ver sion={value of g_strVersion}
This url is well formed and you should get correct values for the SQL, Title
and Version parameters.

Final note: the Sql and even Title parameters may contain unwanted
characters like ? or & that will again disturb the parsing of the url, it is
strongly recommended to encode the values so that they fit into an url.

The final code should look like :
strVal_1= "?SQL=" & Server.UrlEncod e(g_strSQL)
strVal_2= "&Title=" & Server.UrlEncod e(g_strTitle)
strVal_3= "&Version=" & g_strVersion

Response.Redire ct("http://localhost/misc/frmEntry.aspx=" & strVal_1 &
strVal_2 & strVal_3)

DK

Jul 19 '05 #3
You probably need to URLEncode the variables.

You can look that up in the help system.

"William Ryan" <do********@nos pam.comcast.net > wrote in message
news:uU******** *****@TK2MSFTNG P12.phx.gbl...
Paul...I'm not sure but when you step through it in the debugger, I'm
assuming all the assignement are done correctl ( ie strVal_1, strVal_2 and
strVal3)

Try this...

Dim sb as New System.Text.Str ingbuilder
sb.Append("http ://localhost/misc/frmEntry.aspx?E rror=")
sb.Append("?SQL =" & strSQL)
sb.Append("&Tit le=" & g_strTitle)
sb.Append("&Ver sion=" & g_strVersion)
'Put breakpoint here to make sure redirect is what you want in it's
entirety - in the command window ?sb.ToSTring

Response.Redire ct(sb.ToSTring)

It looks like the + might be the cause of improper string concatenation. In either case, even if you don't use a stringbuilder, just add on all
concatenations with the line continue character _ b/c as it stands now,
you're creating at a minimum 3 string objects when one would do. (This
isn't the problem you are referring to, but it's just a suggestion for
efficiency's sake.)

Let me know if the full query string is getting populated correctly and if
so, we'll try to narrow it down from there.

Good Luck,

Bill

"Paul M." <pa**@nospam.fs net.co.uk> wrote in message
news:bi******** **@news6.svr.po l.co.uk...
Hi,
I am trying to populate 3 paramters in an asp .net (vb) page redirect, the first one is ok ok and gets populated by the other two get inserted into
the url for the redirect as empty strings! Anyone got any clues?? The code is below and I have checked that the variables beginning with "g_str" are all populated before the code is called. I think its something to do with the "&" in the "&Title" and "&Version", do I need to do something to
those???

Cheers
Paul

Dim strVal_1 as string
Dim strVal_2 as string
Dim strVal_3 as string

strVal_1= "?SQL=" & g_strSQL
strVal_2= "&Title=" + g_strTitle
strVal_3= "&Version=" + g_strVersion

Response.Redire ct("http://localhost/misc/frmEntry.aspx?E rror=" &

strVal_1 &
strVal_2 & strVal_3)


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3039
by: Andrew Thompson | last post by:
I have written a few scripts to parse the URL arguments and either list them or allow access to the value of any parameter by name. <http://www.physci.org/test/003url/index.html> <http://www.physci.org/test/003url/index.html?url=http://mybiz.com/&that=this&when=now#21> <http://www.physci.org/test/003url/index.html?url=http://mybiz.com/&when=now> Before I go offering it in public (and writing it into any number of the 'development kits'...
10
2350
by: Adis | last post by:
Asp.Net Visual Studio 2003 SQL Server. Hi, Obtaining Data Based Upon Multiple Selections From a ListBox... I have database in Sqlserver and ListBox (Multiple Selection Mode) in my Visual Studio Webform. I wish obtain various records from My_Store_Procedure
4
299
by: Paul M. | last post by:
Hi, I am trying to populate 3 paramters in an asp .net (vb) page redirect, the first one is ok ok and gets populated by the other two get inserted into the url for the redirect as empty strings! Anyone got any clues?? The code is below and I have checked that the variables beginning with "g_str" are all populated before the code is called. I think its something to do with the "&" in the "&Title" and "&Version", do I need to do something to...
0
2644
by: jennifer.perkins | last post by:
I've seen a couple posts by people having similar problems, but the suggested solutions I've tried so far haven't worked. I'm using a SOAP client in VB.Net (constructed by wsdl.exe) and the third party web service it's consuming is served by Axis. The request messages my client sends are processed fine by the server, and the SOAP response is making its way to my client - but when .Net finishes processing the message I end up with an...
3
11562
by: eagleofjade | last post by:
I am trying to help a friend who is learning VB.net in school. I have done VB programming for a number of years using VB 6. He needs to open a query in an Access database that has parameters so he can work with the returned records. In VB 6, I use DAO and do it this way: Dim db As Database Dim rs As Recordset Dim qd As QueryDef
7
11282
by: Aaron Gray | last post by:
I put together the following code to get the href's parameters :- function GetParameters() { var arg = new Object(); var href = document.location.href; if ( href.indexOf( "?") != -1) { var params = href.split( "?");
8
4793
by: yawnmoth | last post by:
Say I have the following HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <form action="">
3
3363
by: Haleigh | last post by:
I just started a few days ago, so I'm very new to this. I'm trying to update a gridview using a store procedure. When I am in the update subroutine, newvalues and oldvalues are empty, plus count is zero. Here is the code I have. What I really want to do is get the changed value for startdate and endate just before doing an update. Thanks <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"...
4
8981
kcdoell
by: kcdoell | last post by:
Hello: What is the best way to stop a report from running if the query is empty? Currently, I have a form that has a command button on it. The user has to make selections from 3 combo boxes on the form and then via the cmdbutton the report opens in preview mode. I want to stop it from executing if the query is empty. I thought I could do this by checking the record count by the following code but I error out with the following message: ...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.