473,785 Members | 2,969 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbe question ---- response.writef ile

oz
private void Page_Load(objec t sender, System.EventArg s e)
{
if(!IsPostBack)
{
String FileName;
FileInfo MyFileInfo;
Long StartPos = 0, FileSize;
FileName = "J:\\Summary.tx t";
MyFileInfo = new FileInfo(FileNa me);
FileSize = MyFileInfo.Leng th;

Response.Output .Write("Please Login: <br>");
Response.WriteF ile(FileName, StartPos, FileSize);
}
}
}

put this in the page load event, then use view source from the brower. the
please login and content of the summary file are printed outside of the html
tags of the page? it also prints the "please login:" and content of the file
3 times????why?
Nov 19 '05 #1
1 1168
oz
hi,
here is the full source code of the cs codebehind file, the aspx file is
generic.

using System;
using System.Web;
using System.Web.UI;
using System.IO;

namespace MCAD315_3
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.P age
{
private void Page_Load(objec t sender, System.EventArg s e)
{
if(!IsPostBack)
{
String FileName;
FileInfo MyFileInfo;
long StartPos = 0, FileSize;
FileName = "J:\\Summary.tx t";
MyFileInfo = new FileInfo(FileNa me);
FileSize = MyFileInfo.Leng th;

Response.Write( "Please Login: <br>");
Response.WriteF ile(FileName, StartPos, FileSize);
}

}

#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.Load += new System.EventHan dler(this.Page_ Load);
}
#endregion
}
}
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.