Wrox Programmer Forums
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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 July 19th, 2005, 10:11 AM
Authorized User
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to aowen355
Default How do I make this C# code work in ASP.NET?

Basically what I want to do is have a button on ASP.NET page with this C# code behind it:
FileStream outputFile = new FileStream("outp.txt",FileMode.OpenOrCreate);
StreamWriter sw = new StreamWriter(outputFile);
sw.Write("hey there");

 In C# this code writes the text to a file, but when I put this code in ASP.NET (using C#) it does not work. I must be missing a step, can someone help?

Old July 19th, 2005, 01:00 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

You need to provide an explicit file path for the output file. Start with the Server.MapPath() method and work from there.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could .NET make GUI like MSN with code? vas General .NET 0 May 6th, 2008 03:10 AM
Code to make crystal viewer (10) work with access Charinator Access 0 November 16th, 2006 05:26 AM
code clinic - Why wont example asp code work? jardbf Classic ASP Basics 3 April 27th, 2006 06:22 PM
This is how to make ASPEXEC, WSH work thru ASP texter Classic ASP Professional 3 September 1st, 2004 07:13 PM
This is how to make ASPEXEC, WSH work thru ASP texter Classic ASP Components 0 August 4th, 2004 11:58 PM

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