building url newbie question - HELP:)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Q2hyaXMgRA==?=

    #1

    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/CcspConfirmRegi stration.htm?Re gistrant='" + registrant.ToSt ring + ">Confirm Registration</a></p>"
  • Peter Duniho

    #2
    Re: building url newbie question - HELP:)

    On Sat, 05 Jul 2008 16:48:01 -0700, Chris D
    <ChrisD@discuss ions.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.ToS tring()".

    Comment

    • =?Utf-8?B?Q2hyaXMgRA==?=

      #3
      Re: building url newbie question - HELP:)

      Hi Peter - thanks for helping but the following :

      sBody += "<a
      href='https://dev.onlineforms .phsa.ca/Ccsp/CcspConfirmRegi stration.htm?Re gistrant='" + 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



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

      "Peter Duniho" wrote:
      On Sat, 05 Jul 2008 16:48:01 -0700, Chris D
      <ChrisD@discuss ions.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.ToS tring()".
      >

      Comment

      • Peter Duniho

        #4
        Re: building url newbie question - HELP:)

        On Sat, 05 Jul 2008 20:45:02 -0700, Chris D
        <ChrisD@discuss ions.microsoft. comwrote:
        Hi Peter - thanks for helping but the following :
        >
        sBody += "<a
        href='https://dev.onlineforms .phsa.ca/Ccsp/CcspConfirmRegi stration.htm?Re gistrant='"
        + 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/CcspConfirmRegi stration.htm?Re gistrant="
        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/CcspConfirmRegi stration.htm?Re gistrant="
        +
        this.registrant .ToString() + "'>Confirm Registration</a></p>";

        would work better.

        Pete

        Comment

        • =?Utf-8?B?Q2hyaXMgRA==?=

          #5
          Re: building url newbie question - HELP:)

          Bingo!!!!! ... :-) You made my day Peter. Huge thanks ... Chris

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

          sBody += "<a
          href='https://dev.onlineforms .phsa.ca/Ccsp/CcspConfirmRegi stration.htm?Re gistrant='"
          + 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/CcspConfirmRegi stration.htm?Re gistrant="
          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/CcspConfirmRegi stration.htm?Re gistrant="
          +
          this.registrant .ToString() + "'>Confirm Registration</a></p>";
          >
          would work better.
          >
          Pete
          >

          Comment

          • Peter Morris

            #6
            Re: building url newbie question - HELP:)

            url = string.Format(" https://dev.blah.ca/blah?Registrant ={0}",
            HttpUtility.Url Encode(registra nt));

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


            Pete

            Comment

            • =?Utf-8?B?Q2hyaXMgRA==?=

              #7
              Re: building url newbie question - HELP:)


              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.Url Encode(registra nt));
              >
              01: It's neater to use string.Format
              02: You need to use UrlEncode.
              >
              >
              Pete
              >
              >

              Comment

              Working...