troubleshooting Question

Aspx Scripts

Avatar of Richard Korts
Richard KortsFlag for United States of America asked on
10 Comments1 Solution998 ViewsLast Modified:
This issue is about Microsoft dot net environment.

I inherited a web site with aspx files. I have taken a class in dot net but I'm novice at it. I am a 10 year expericenced web developer with LOTS of asp, php, javascript, etc. experience.

We are adding a new type of order to the web site. In the current configurstion, there is a folder on the server called "Orders" where text files are created for orders. Thers is an aspx page (and correspondiong aspx.cs codebehind page) that provide the ability to download the orders for a date range specified using a set of calendar controls. These two files (aspx & aspx.cs) follow:

<%@ Page language="c#" Codebehind="GetOrders.aspx.cs" AutoEventWireup="false" Inherits="CoffeePond.Admin.GetOrders" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
            <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="">
            BODY { FONT-SIZE: 9pt; FONT-FAMILY: tahoma,verdana,geneva,helvetica,sans-serif }
            TD { FONT-SIZE: 9pt; FONT-FAMILY: tahoma,verdana,geneva,helvetica,sans-serif }
            .Small { FONT-SIZE: 7.5pt; FONT-FAMILY: tahoma,verdana,geneva,helvetica,sans-serif }
            <form id="Form1" method="post" runat="server">
                  <table align="center" width="580">
                              <td colspan="5">
                                    <h3>COFFEEPOND Order Reports</h3>
                                    <p>Select a range of dates to report orders for and click <b>Report</b> to generate
                              <td colspan="5" align="center" style="PADDING-BOTTOM:5px;PADDING-TOP:5px"><asp:Label ID="ErrorMessage" Runat="server" ForeColor="Red" Font-Bold="True" /></td>
                        <tr valign="top">
                              <td><asp:calendar id="StartDate" runat="server" CssClass="Small" ShowGridLines="True"></asp:calendar></td>
                              <td><asp:calendar id="EndDate" runat="server" CssClass="Small" ShowGridLines="True"></asp:calendar></td>
                              <td colspan="5" align="center"><br>
                                    <asp:Button ID="Report" Runat="server" Text="Report" OnClick="Report_Click" />
                                    <asp:Label ID="OrdersHelp" Runat="server" CssClass="Small" Visible="False">Right click the link below and select "Save Target As..." to save the order file locally.</asp:Label>
                                    <asp:Label ID="Orders" Runat="server" />

aspx.cs file:

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;
using System.IO;

namespace CoffeePond.Admin
      /// <summary>
      /// Summary description for GetOrders.
      /// </summary>
      public class GetOrders : System.Web.UI.Page
            protected System.Web.UI.WebControls.Calendar StartDate;
            protected System.Web.UI.WebControls.Button Report;
            protected System.Web.UI.WebControls.Label ErrorMessage;
            protected System.Web.UI.WebControls.Label Orders;
            protected System.Web.UI.WebControls.Label OrdersHelp;
            protected System.Web.UI.WebControls.Calendar EndDate;
            private void Page_Load(object sender, System.EventArgs e)
                  // Put user code to initialize the page here

            public void Report_Click(object sender, System.EventArgs e)
                  DateTime Today = DateTime.Now;
                  String strMasterFileName = "OrderList_" + Today.ToString().Replace("/","_").Replace(" ","_").Replace(":",".") + ".txt";
                  StreamWriter sw = new StreamWriter(@Server.MapPath(strMasterFileName), false);
                  sw.WriteLine("ChildsFirstName, ChildsLastName, ShippingStreet, ShippingCity, ShippingState, ShippingZIPCode, ShippingPhone, EmailAddress, ContactMethod, SchoolName, Childs_Grade, Advisor, Quantity1, Package1, Book1, Retouch1, Quantity2, Package2, Book2, Retouch2, Quantity3, Package3, Book3, Retouch3, Quantity4, Package4, Book4, Retouch4, RetouchInstructions, SpecialInstructions, OrderPerson, CCType, CCNumber, CCDate, CCName, Retouching, Tax, Shipping, Total, OrderType");
                  DirectoryInfo dir = new DirectoryInfo(Server.MapPath("..\\Orders"));
                  foreach (FileInfo f in dir.GetFiles("*.*"))
                        String name = f.Name;
                        StreamReader SR;
                        string S;
                        String strDateName = name.Replace("_","/").Replace(".txt","");
                        DateTime FileDate = Convert.ToDateTime(strDateName);

                        if (FileDate >= StartDate.SelectedDate && FileDate <= EndDate.SelectedDate)

                              SR=File.OpenText(Server.MapPath("..\\Orders\\" + name));

                                    Orders.Text = Orders.Text + S + "\n";
                                    StreamWriter sw2 = new StreamWriter(@Server.MapPath(strMasterFileName), true);
                  Orders.Text = "<a href=\"" + strMasterFileName + "\">Order List</a>";
                  OrdersHelp.Visible = true;

            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
                  this.Load += new System.EventHandler(this.Page_Load);


I am storing the new type of order in a folder called yborders (at the same level & with a similar structure to) the Orders folder.

I changed some text in the aspx file, changed the reference to the code behind file to a different name & saved the aspx file. I changed the aspx.cs file to reference the correct folder (yborders), changed the header & dsaved it with the different name I referenced as the code behind name in the aspx page.

When I run the modified aspx page, it looks fine, but it picks up the orders from the Orders folder & uses the old header. It's like the new aspx page is still referring to the old aspx.cs page.

In the folder on the server where the aspx & aspx.cs download order files are located, the only other file is an aspx.resx file. What else do I have to change to force the new aspx file to refer to the correct aspx.cs file?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros