Proper Way to add tbxXXX.Text to URL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eSolTec, Inc. 501(c)(3)

    #1

    Proper Way to add tbxXXX.Text to URL

    Thank you in advance for any and all assistance. It is greatly appreciated.

    What is the proper way to add textboxes to a URL so that the the text is
    part of the URL? is it a "+" sign or the "&" ampersign?




    Michael Bragg, President
    eSolTec, Inc.
    a 501(C)(3) organization
    MS Authorized MAR
    looking for used laptops for developmentally disabled.
  • Herfried K. Wagner [MVP]

    #2
    Re: Proper Way to add tbxXXX.Text to URL

    "eSolTec, Inc. 501(c)(3)" <esoltec@noemai l.nospamschrieb :
    What is the proper way to add textboxes to a URL so that the the text is
    part of the URL? is it a "+" sign or the "&" ampersign?
    >
    https://secure.plimus.com/jsp/valida...ion=REGISTER--
    If the URL is stored as a string, you can use the '&' operator:

    \\\
    Dim Url As String = ...
    Url &= "bla"
    ///

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • eSolTec, Inc. 501(c)(3)

      #3
      Re: Proper Way to add tbxXXX.Text to URL

      Herfried,

      Thank you for your quick response. What would cause a textbox not to display
      it's contents as the concatenated information. All I'm seeing is the URL
      which is converted to a string and then = tbxLicense.Text and not the
      contents of the textbox? HELP
      --
      Michael Bragg, President
      eSolTec, Inc.
      a 501(C)(3) organization
      MS Authorized MAR
      looking for used laptops for developmentally disabled.


      "Herfried K. Wagner [MVP]" wrote:
      "eSolTec, Inc. 501(c)(3)" <esoltec@noemai l.nospamschrieb :
      What is the proper way to add textboxes to a URL so that the the text is
      part of the URL? is it a "+" sign or the "&" ampersign?

      https://secure.plimus.com/jsp/valida...ion=REGISTER--
      >
      If the URL is stored as a string, you can use the '&' operator:
      >
      \\\
      Dim Url As String = ...
      Url &= "bla"
      ///
      >
      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
      >
      >

      Comment

      • Jay B. Harlow [MVP - Outlook]

        #4
        Re: Proper Way to add tbxXXX.Text to URL

        Michael,
        You need to build a string expression, it appears that you have a single
        string.

        Something like:


        Dim url As String = _
        "https://secure.plimus.c om/jsp/validateKey.jsp ?productId=" _
        & tbxUser.text & "&key=" & tbxLicense.text & _
        "&action=REGIST ER--"

        --
        Hope this helps
        Jay B. Harlow [MVP - Outlook]
        ..NET Application Architect, Enthusiast, & Evangelist
        T.S. Bradley - http://www.tsbradley.net


        "eSolTec, Inc. 501(c)(3)" <esoltec@noemai l.nospamwrote in message
        news:03995CEA-954B-4E27-997C-36B511CAE3C4@mi crosoft.com...
        | Herfried,
        |
        | Thank you for your quick response. What would cause a textbox not to
        display
        | it's contents as the concatenated information. All I'm seeing is the URL
        | which is converted to a string and then = tbxLicense.Text and not the
        | contents of the textbox? HELP
        | --
        | Michael Bragg, President
        | eSolTec, Inc.
        | a 501(C)(3) organization
        | MS Authorized MAR
        | looking for used laptops for developmentally disabled.
        |
        |
        | "Herfried K. Wagner [MVP]" wrote:
        |
        | "eSolTec, Inc. 501(c)(3)" <esoltec@noemai l.nospamschrieb :
        | What is the proper way to add textboxes to a URL so that the the text
        is
        | part of the URL? is it a "+" sign or the "&" ampersign?
        |
        |

        | >
        | If the URL is stored as a string, you can use the '&' operator:
        | >
        | \\\
        | Dim Url As String = ...
        | Url &= "bla"
        | ///
        | >
        | --
        | M S Herfried K. Wagner
        | M V P <URL:http://dotnet.mvps.org/>
        | V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
        | >
        | >



        Comment

        • Steven Cheng[MSFT]

          #5
          Re: Proper Way to add tbxXXX.Text to URL

          Hello Michael,

          If what you want is to embed some text string(get from a TextBox's Text
          property) into an existing url string, you can use string concatenate like:

          =============== =
          Dim url As String = "http://www.test.org/site1/default.aspx"
          url = url & "?param1=" & TextBox1.Text
          =============== ===
          #for VB.NET, you should use "&" char to concatenate string while in C#, you
          should use "+"


          You can also use String.Format method to create template based string text.
          e.g.

          =============== =========
          Dim urltmp As String =
          "http://www.asp.net/default.aspx?pa ram1={0}&param2 ={1}"
          Dim url As String = String.Format(u rltmp, TextBox1.Text, TextBox2.Text)
          =============== =========

          In addition, if the text you want to append into url querystring will
          contains some particular characters (such as "&", "+", or wide chars...), I
          suggest you use HttpUtility.Url Encode method to encode it before append
          them into url.

          #HttpUtility.Ur lEncode Method
          http://msdn2.microsoft.com/en-us/lib...y.urlencode.as
          px

          e.g.

          =============== =====
          Dim urltmp As String =
          "http://www.asp.net/default.aspx?pa ram1={0}&param2 ={1}"
          Dim url As String = String.Format(u rltmp,
          HtmlUtility.Url Encode(TextBox1 .Text), HtmlUtility.Url Encode(TextBox2 .Text))
          =============== =====

          Hope this helps.

          Sincerely,

          Steven Cheng

          Microsoft MSDN Online Support Lead


          This posting is provided "AS IS" with no warranties, and confers no rights.

          Comment

          Working...