Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 12th, 2005, 06:10 AM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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("&nbsp;"," ");
                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>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Cookie problem ps0208 Servlets 1 November 5th, 2007 05:55 AM
Cookie problem Raptor-X ASP.NET 2.0 Basics 0 November 16th, 2006 08:58 AM
COOKIE problem Buravik PHP How-To 2 May 9th, 2004 08:47 AM
Session cookie problem rogierio Classic ASP Professional 0 October 15th, 2003 09:50 AM
cookie problem bluewater68 Classic ASP Professional 0 August 26th, 2003 06:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.