PC Review


Reply
Thread Tools Rate Thread

building url newbie question - HELP:)

 
 
Chris D
Guest
Posts: n/a
 
      6th Jul 2008
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>"
 
Reply With Quote
 
 
 
 
Chris D
Guest
Posts: n/a
 
      6th Jul 2008
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
> <(E-Mail Removed)> wrote:
>
> > 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()".
>

 
Reply With Quote
 
Chris D
Guest
Posts: n/a
 
      6th Jul 2008
Bingo!!!!! ... :-) You made my day Peter. Huge thanks ... Chris

"Peter Duniho" wrote:

> On Sat, 05 Jul 2008 20:45:02 -0700, Chris D
> <(E-Mail Removed)> wrote:
>
> > 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
>

 
Reply With Quote
 
Peter Morris
Guest
Posts: n/a
 
      6th Jul 2008
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

 
Reply With Quote
 
Chris D
Guest
Posts: n/a
 
      7th Jul 2008

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
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie-ish Question about Building Reports from a Datamart Gummy Microsoft ASP .NET 4 31st Mar 2006 10:07 PM
Ok go easy on this newbie. Barebones question Building my first Aurora Asus Motherboards 9 7th Nov 2004 05:46 AM
Newbie Question?Deploying, building a setup program? =?Utf-8?B?U3RldmUgSw==?= Microsoft Dot NET Compact Framework 2 24th May 2004 02:51 PM
Newbie Component Building advice Eric Mamet Microsoft Dot NET 0 31st Oct 2003 03:41 PM
Typical newbie "I'm building a computer" question Andrew Van Hout DIY PC 9 1st Jul 2003 04:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 AM.