Cookie Problem
Hello,
I have a problem with 2 pages of my site. I'm not sure if its the code or the server, as I have exactly the same code on another site hosted on a different server which works fine. I'm using C#, dreamweaver and spaw text editor.
I'm trying to pass a textbox value from one page to the next, replacing some characters. However the cookie only records the first paragraph of user input, ignoring the rest. I've copied the code below - I'll appreciate any help.
Thanks
Joyce
edit_guide1.aspx
------------------
<%@ Register TagPrefix="uc1" TagName="spaw" Src="../../spaw/spaw/spaw.ascx" %>
<%@ Page Language="c#" ContentType="text/html" ResponseEncoding="iso-8859-1" validateRequest="false" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicK eyToken=836f606ede05d46a,culture=neutral" %>
//Dataset code here - not copied as very long.
<MM:PageBind runat="server" PostBackBind="true" />
<script language="c#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
HttpCookie objckusername = Request.Cookies["ckusername"];
if (objckusername == null)
{
Response.Redirect("../index.aspx");
}
if (!Page.IsPostBack)
{
Spaw1.Text = dsGuide.FieldValue("guideBody", null);
Title1Text.Text = dsGuide.FieldValue("guideTitle", null);
btnEdit2.Visible = false;
}
if (Page.IsPostBack)
{
// display the contents of the editors
Spaw1.Text = Spaw1.Text;
pan1.Visible = true;
Spaw1Text.Text = Spaw1.Text.Replace("%0d%0a","");
Title1Text.Text = txtTitle.Text;
btnEdit2.Visible = true;
txtBod.Value = Spaw1Text.Text;
Response.Cookies["guideTitle"].Value = txtTitle.Text;
Response.Cookies["guideBody"].Value = Spaw1.Text.Replace(" "," ");
Response.Cookies["guideID"].Value = dsGuide.FieldValue("guideID", null);
}
}
</script>
edit_guide2.aspx
-----------------
<%@ Page Language="c#" ContentType="text/html" ResponseEncoding="iso-8859-1" validateRequest="false" %>
<%@ Register TagPrefix="uc1" TagName="spaw" Src="../../spaw/spaw/spaw.ascx" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicK eyToken=836f606ede05d46a,culture=neutral" %>
<MM:Update
runat="server"
CommandText='<%# "UPDATE tblGuides SET displayID=?, guideAdded=?, guideBody=?, guideMod=?, guideTitle=?, areaID=? WHERE guideID=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSett ings["MM_CONNECTION_STRING_connSpecials"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSett ings["MM_CONNECTION_DATABASETYPE_connSpecials"] %>'
Expression='<%# Request.Form["MM_update"] == "form1" %>'
CreateDataSet="false"
SuccessURL='<%# "view_guides.aspx" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@displayID" Value='<%# ((Request.Form["rbPublish"] != null) && (Request.Form["rbPublish"].Length > 0)) ? Request.Form["rbPublish"] : "" %>' Type="Integer" />
<Parameter Name="@guideAdded" Value='<%# ((Request.Form["txtAdded"] != null) && (Request.Form["txtAdded"].Length > 0)) ? Request.Form["txtAdded"] : "" %>' Type="Date" />
<Parameter Name="@guideBody" Value='<%# ((Request.Form["txtBody"] != null) && (Request.Form["txtBody"].Length > 0)) ? Request.Form["txtBody"] : "" %>' Type="WChar" />
<Parameter Name="@guideMod" Value='<%# ((Request.Form["txtMod"] != null) && (Request.Form["txtMod"].Length > 0)) ? Request.Form["txtMod"] : "" %>' Type="Integer" />
<Parameter Name="@guideTitle" Value='<%# ((Request.Form["txtTitle"] != null) && (Request.Form["txtTitle"].Length > 0)) ? Request.Form["txtTitle"] : "" %>' Type="WChar" />
<Parameter Name="@areaID" Value='<%# ((Request.Form["rblArea"] != null) && (Request.Form["rblArea"].Length > 0)) ? Request.Form["rblArea"] : "" %>' Type="Integer" />
<Parameter Name="@guideID" Value='<%# ((Request.Form["ID"] != null) && (Request.Form["ID"].Length > 0)) ? Request.Form["ID"] : "" %>' Type="Integer" />
</Parameters>
</MM:Update>
<script runat="server">
void Page_Load(Object s, EventArgs e)
{
HttpCookie objckusername = Request.Cookies["ckusername"];
if (objckusername == null)
{
Response.Redirect("../index.aspx");
}
else
{
txtTitle.Text = Request.Cookies["guideTitle"].Value.ToString();
txtBody.Text = Request.Cookies["guideBody"].Value.ToString().Replace("%0d%0a", " ");
}
}
</script>
|