473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

building url newbie question - HELP:)

Hi - can someone PLEASE tell me what's wrong with the script below. In debug
I verified that 'registrant' has a value. I can't figure our how to build the
URL & this script generates the error "operator + cannot be applied to
operands of type string & method group". MANY THANKS

<a
href='https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant='" + registrant.ToString + ">Confirm Registration</a></p>"
Jul 5 '08 #1
6 2274
On Sat, 05 Jul 2008 16:48:01 -0700, Chris D
<Ch****@discussions.microsoft.comwrote:
Hi - can someone PLEASE tell me what's wrong with the script below. In
debug
I verified that 'registrant' has a value. I can't figure our how to
build the
URL & this script generates the error "operator + cannot be applied to
operands of type string & method group". MANY THANKS
Put a pair of parens after "ToString". As in "registrant.ToString()".
Jul 6 '08 #2
Hi Peter - thanks for helping but the following :

sBody += "<a
href='https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant='" + this.registrant.ToString() + ">Confirm Registration</a></p>";

still comes back with the Url below yet Debug returns (String) 67 for
'registrant' & the project builds without error

https://dev.onlineforms.phsa.ca/Ccsp...tm?Registrant=

-----------------------------------------------------------------

"Peter Duniho" wrote:
On Sat, 05 Jul 2008 16:48:01 -0700, Chris D
<Ch****@discussions.microsoft.comwrote:
Hi - can someone PLEASE tell me what's wrong with the script below. In
debug
I verified that 'registrant' has a value. I can't figure our how to
build the
URL & this script generates the error "operator + cannot be applied to
operands of type string & method group". MANY THANKS

Put a pair of parens after "ToString". As in "registrant.ToString()".
Jul 6 '08 #3
On Sat, 05 Jul 2008 20:45:02 -0700, Chris D
<Ch****@discussions.microsoft.comwrote:
Hi Peter - thanks for helping but the following :

sBody += "<a
href='https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant='"
+ this.registrant.ToString() + ">Confirm Registration</a></p>";

still comes back with the Url below yet Debug returns (String) 67 for
'registrant' & the project builds without error
https://dev.onlineforms.phsa.ca/Ccsp...tm?Registrant=
I'm having a hard time really understanding your question. There's just
so little context and the question itself is hard to parse.

However, given that you've surrounded the text
"https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant="
with single-quotes, I'm not too surprised that that's what comes back as
the URL. The text you're trying to add to that is outside the
single-quotes and so wouldn't be considered part of the URL (you maybe
should consider yourself lucky you get any URL at all out of that :) ).

Perhaps changing the code to read:

sBody += "<a
href='https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant="
+
this.registrant.ToString() + "'>Confirm Registration</a></p>";

would work better.

Pete
Jul 6 '08 #4
Bingo!!!!! ... :-) You made my day Peter. Huge thanks ... Chris

"Peter Duniho" wrote:
On Sat, 05 Jul 2008 20:45:02 -0700, Chris D
<Ch****@discussions.microsoft.comwrote:
Hi Peter - thanks for helping but the following :

sBody += "<a
href='https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant='"
+ this.registrant.ToString() + ">Confirm Registration</a></p>";

still comes back with the Url below yet Debug returns (String) 67 for
'registrant' & the project builds without error
https://dev.onlineforms.phsa.ca/Ccsp...tm?Registrant=

I'm having a hard time really understanding your question. There's just
so little context and the question itself is hard to parse.

However, given that you've surrounded the text
"https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant="
with single-quotes, I'm not too surprised that that's what comes back as
the URL. The text you're trying to add to that is outside the
single-quotes and so wouldn't be considered part of the URL (you maybe
should consider yourself lucky you get any URL at all out of that :) ).

Perhaps changing the code to read:

sBody += "<a
href='https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant="
+
this.registrant.ToString() + "'>Confirm Registration</a></p>";

would work better.

Pete
Jul 6 '08 #5
url = string.Format("https://dev.blah.ca/blah?Registrant={0}",
HttpUtility.UrlEncode(registrant));

01: It's neater to use string.Format
02: You need to use UrlEncode.
Pete

Jul 6 '08 #6

Thanks Peter - much, much cleaner than my string:) Have a good week ... c

"Peter Morris" wrote:
url = string.Format("https://dev.blah.ca/blah?Registrant={0}",
HttpUtility.UrlEncode(registrant));

01: It's neater to use string.Format
02: You need to use UrlEncode.
Pete

Jul 7 '08 #7

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

Similar topics

1
by: Ye | last post by:
I have a HTML Help built in my project in visual C++ 6.0, when I transfered the project into .Net, the HTML help can not work. No response after I hit F1 or selected from the menu help. It worked...
0
by: Knackerud | last post by:
Hi there, I'm building the simplest small web browser, using Visual C++ (2005 Express Edition), making a form, dragging over the WebBrowser from the toolbox, setting the initial URL, and...
0
jeffbroodwar
by: jeffbroodwar | last post by:
Hi, i'm currently working on a project that uses java and mysql database. can someone give me code & tutorial on how can i make java (using netbeans) read an xml file that contains the fields of the...
1
by: pjawde | last post by:
i'm new to this oracle thing!!!! sorry if its a dumbass question but i simply want a menu button that will talk me to certain forms......... i have created the trigger when button pressed and just...
2
by: UnderCoverGuy | last post by:
Hello. I am trying to produce a SQL report query that determines the type (model) of system a user has and based off of that information, CASE selects to determine the amount of and type of memory...
0
by: 1druid1 | last post by:
Hi All Our programmer has just left the company for pastures new and I have been left to pick up the pieces, unfortuantly I have never used MS SQL or Visual Studios 2005, but I am now required to...
3
by: jonathon | last post by:
Hi. I'm currently making a free medical revision site for medical students. A forum is critical to the development of my site. My sever has phpbb 2.01 which does not support subforums. Is there any...
1
by: dsoutherland | last post by:
I am so new to ASP I'm not sure I am breathing. A company one of my clients deals with provides information over the web. They provided the ASP code for a default web site that is used to...
3
by: swinuser | last post by:
Hi, i'm VERY new to Access.... i don't even know how to ask... but when you first open an already created database and it only opens the 'switchboard' and doesn't give the option of the tables......
1
by: blackdagger | last post by:
I was making a program, a simple passbook, but I'm kinda new to ADODB...I have a database in MS Access. In my program, I have to type in the account number then by pressing enter key, the name of...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.