URL direct

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hello everyone,

I'm trying to do something which should be incredibly simple. I would like
to create an aspx page with one text box and one submit button on it. The
text box would allow a user to enter a word (or anything really.) Upon
submission, the browser would load a URL with the word string appended at
the end in the current window. Please can anyone help?


James
 
Try using the following command:

Response.Redirect(Request.Url.AbsolutePath & txtMyTextBox.Text)

Place this code in the Click event of your submit button. If you need any
extra text included in the URL (such as a ?myword= if you are trying to
create a querystring), simply modify the String that is used as the
parameter. Good Luck!
 
Fankoo! Xo)


Nathan Sokalski said:
Try using the following command:

Response.Redirect(Request.Url.AbsolutePath & txtMyTextBox.Text)

Place this code in the Click event of your submit button. If you need any
extra text included in the URL (such as a ?myword= if you are trying to
create a querystring), simply modify the String that is used as the
parameter. Good Luck!
 
C#
string appendWord = textbox1.Text;
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.Append(Request.Url.AbsolutePath.ToString());
urlBuilder.Append("?myword=");
urlBuilder.Append(appendWord);

Response.Redirect(urlBuilder.ToString());

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

********************************************
Think outside the box!
********************************************
 
Back
Top