|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Proper Way to add tbxXXX.Text to URLThank 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? https://secure.plimus.com/jsp/validateKey.jsp?productId=tbxUser.text&key=tbxLicense.text&action=REGISTER-- Michael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled. "eSolTec, Inc. 501(c)(3)" <esoltec@noemail.nospam> schrieb: If the URL is stored as a string, you can use the '&' operator:> 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/validateKey.jsp?productId=tbxUser.text&key=tbxLicense.text&action=REGISTER-- \\\ 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/> 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 -- Show quoteHide quoteMichael 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@noemail.nospam> schrieb: > > 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/validateKey.jsp?productId=tbxUser.text&key=tbxLicense.text&action=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/> > > 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.com/jsp/validateKey.jsp?productId=" _ & tbxUser.text & "&key=" & tbxLicense.text & _ "&action=REGISTER--" -- Show quoteHide quoteHope 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@noemail.nospam> wrote in message https://secure.plimus.com/jsp/validateKey.jsp?productId=tbxUser.text&key=tbxLicense.text&action=REGISTER--news:03995CEA-954B-4E27-997C-36B511CAE3C4@microsoft.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@noemail.nospam> schrieb: | > > 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? | > > | > > Show quoteHide quote | > | > 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/> | > | > 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?param1={0}¶m2={1}" Dim url As String = String.Format(urltmp, 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.UrlEncode method to encode it before append them into url. #HttpUtility.UrlEncode Method http://msdn2.microsoft.com/en-us/library/system.web.httputility.urlencode.as px e.g. ==================== Dim urltmp As String = "http://www.asp.net/default.aspx?param1={0}¶m2={1}" Dim url As String = String.Format(urltmp, HtmlUtility.UrlEncode(TextBox1.Text), HtmlUtility.UrlEncode(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. |
|||||||||||||||||||||||