Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 19th, 2005, 10:11 AM
Authorized User
 
Join Date: Jun 2005
Location: Rome, ny, .
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:
Code:
     
FileStream outputFile = new FileStream("outp.txt",FileMode.OpenOrCreate);
StreamWriter sw = new StreamWriter(outputFile);
sw.Write("hey there");
sw.Close();

 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?

  #2 (permalink)  
Old July 19th, 2005, 01:00 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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

-Peter
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:41 AM.


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