Forum Moderators: open
Request.querystring("fieldName")
If you're just wanting to replace a + in a string with the space Character, you can use the Replace method
Replace(yourString,"+"," ")
response.redirect("/testfolder/easyedit.asp?action=act&line=:" & request("tble") & "%0D%0A%22" & request("field") & "%22" & "%2C" & request("x") & "%2C" & request("y") & "%2C" & "%22" & request("format") & "%22" & "%2C" & "0")
where "request("field")" needs to record "test+file" exactly like that. The "+" (or "%2B" in url encode) needs to be recorded as a character, not a a space. This must work for any word pair like "thisisa+testfile" so any amount of characters can be on either side of the +. If that makes sence.
You can just use the Server.URLEncode() function to encode the plus sign for you.
so a string like :
I know what 4+5 equals
Would be:
I+know+what+4%2b5+equals
Do you have the ability to compile and run ASP.Net applications? If you do, I mocked up this simple page that will allow you to type into either textarea and see the encoded and decoded outputs:
------------------
TextAreaFormatting.aspx
------------------
<%@ Page language="c#" Codebehind="TextAreaFormatting.aspx.cs" AutoEventWireup="false" Inherits="localhost.TextAreaFormatting" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>TextAreaFormatting</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<asp:TextBox Runat="server" Rows="10" TextMode="MultiLine" ID="txtInformation" AutoPostBack="True" ></asp:TextBox><br>
<asp:TextBox Runat="server" Rows="10" TextMode="MultiLine" ID="txtInformationResponse" AutoPostBack="True"></asp:TextBox>
</form>
</body>
</HTML>
------------------
------------------
TextAreaFormatting.aspx.cs
------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace localhost
{
/// <summary>
/// Summary description for TextAreaFormatting.
/// </summary>
public class TextAreaFormatting : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtInformation;
protected System.Web.UI.WebControls.TextBox txtInformationResponse;
private void Page_Load(object sender, System.EventArgs e)
{
string data = Request.QueryString["TestData"];
if(! IsPostBack )
{
if(data!= null)
{
if(data.Length > 0)
{
txtInformation.Text = Server.UrlEncode( data );
txtInformationResponse.Text = Server.UrlDecode( data );
}
}
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtInformation.TextChanged += new System.EventHandler(this.DuplicateText);
this.txtInformationResponse.TextChanged += new System.EventHandler(this.DuplicateText);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DuplicateText(object sender, System.EventArgs e)
{
System.Web.UI.WebControls.TextBox txtInfo = (System.Web.UI.WebControls.TextBox)sender;
if(txtInfo.ID == "txtInformation")
{
txtInformationResponse.Text = Server.UrlDecode( txtInformation.Text );
}
else if(txtInfo.ID == "txtInformationResponse")
{
txtInformation.Text = Server.UrlEncode(txtInformationResponse.Text);
}
}
}
}
------------------
Have fun!
-mark