Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 August 26th, 2004, 10:39 AM
Authorized User
 
Join Date: Jul 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't write to a text file. Please advise


First off, FYI - my version of .NET Framework 1.1 is (version 1.1.4322.573). So I believe it has the most current service packs. I get the following error message [UnauthorizedAccessException: Access to the path "c:\inetpub\wwwroot\Sessions\MyTextFile.txt" is denied.] and furthemore it says: "ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user"

I don't know what any of that means!


I have looked out on google for the following string "ASP.NET is not authorized to access the requested resource." So I have found other folks have had this error too, but yet again I don't understand their solutions.

NOTE: I am able to write ASP 3.0 applications that write to files. BUT - I had a similar problem when I first began to do ASP 3.0. The issue turned out to be a security issue. I went to --> Default web site properties > Directory Security tab,, I saw that "secured user" was set up to be some weird id. I changed it to be the name of my local computer. I also set the unchecked ALLOW IIS TO CONTROL PASSWORD. and that fixed my ASP 3.0 issues. So what is my trouble this time as I try to do ASP.NET applications.

It does not seem to matter what file path I use for the text file I am trying to write. Here is the actual line of code that is going down -


Dim MyTextFile As StreamWriter

MyTextFile = New StreamWriter("c:\inetpub\wwwroot\Sessions\MyTextFi le.txt"", True) ' <--Boom right here!


Cmarek
__________________
Cmarek
 
Old August 26th, 2004, 11:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

The .NET framework creates an ASPNET user account. Give that user access to the machine (read/write).

Brian
 
Old August 26th, 2004, 11:50 AM
Authorized User
 
Join Date: Jul 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The .NET framework creates an ASPNET user account. Give that user access to the machine (read/write). This sounds right....But how do I do this??? Lets pretend (Pretend?) that I don't know much ok.

Cmarek
 
Old August 26th, 2004, 12:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Check out this FAQ: http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=290 for instruction on changing security permissions.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Shoot by Sonic Youth (Track 5 from the album: Dirty) What's This?
 
Old August 26th, 2004, 01:25 PM
Authorized User
 
Join Date: Jul 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks. This is exactly what I was needing

Cmarek





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write to text file ? method Beginning VB 6 1 April 13th, 2006 01:54 AM
Write in A DOC File With Same Text Formatting Arshi VB How-To 0 February 5th, 2006 05:08 AM
Write ASCII text file muklee C# 1 December 12th, 2004 09:40 PM
Write Text file from recordset rylemer Access 2 December 5th, 2003 10:23 AM
Write column heading to text file cat_trio Access VBA 0 November 13th, 2003 02:32 PM





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