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 December 9th, 2006, 01:37 PM
Authorized User
 
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ashokparchuri Send a message via Yahoo to ashokparchuri
Default Un authorized Exception

Hi i am getting this following error when i run the Xml file could any body please tell me how to solve this.

System.UnauthorizedAccessException: Access to the path "C:\XMLFile1.xml" is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String str)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.Xml.XmlDocument.Save(String filename)
   at mountain.Service1.mountian(String mountainname) in c:\inetpub\wwwroot\mountain\service1.asmx.cs:line 106

Reading of xml file is perfect.When i try to write to the xml file it is giving the problem.

Thanks in Advance-Ashok
 
Old December 9th, 2006, 01:48 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,

Take a look here: http://www.spaanjaars.com/QuickDocId.aspx?QUICKDOC=263

Although the FAQ was originally written for ASP, it can also be used to solve ASP.NET security problems. Be sure to read the linked FAQ that describes how to determine your user account, under the heading "Find Out the Account that IIS Runs Under" as things are a bit different for ASP.NET.

Cheers


Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old December 10th, 2006, 07:30 AM
Authorized User
 
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ashokparchuri Send a message via Yahoo to ashokparchuri
Default

Hi imar it is not the same error what you had given i clearly told that it is the error i am getting from Xml file.I had gone through the doccument and it is not useful to me.Any way if you can help me with the xml file that would be great.

Thanks for your Reply.-Ashok
 
Old December 10th, 2006, 07:33 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think you overlooked something.

From what I can see, it *is* the same root problem but obviously with a different description. The account used by the webserver does not have the required permissions to write XMLFile1.xml in the root of your C drive. The FAQ I linked to explains how to fix this by changing security settings.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old December 11th, 2006, 05:41 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Were you able to fix the problem?

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Lincoln's Gout by Sonic Youth (Track 10 from the album: Made In USA (soundtrack)) What's This?
 
Old December 11th, 2006, 10:20 PM
Authorized User
 
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ashokparchuri Send a message via Yahoo to ashokparchuri
Default

Hi Imar I am sorry to reply you very late.I had done everything as you said.But the the thing is it is related with the databases and for me it is related with xml file.So the thing is not working perfectly.

I am help less to get help.

Anyway thanks for your try to solve My problem-Ashok
 
Old December 11th, 2006, 10:32 PM
Authorized User
 
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ashokparchuri Send a message via Yahoo to ashokparchuri
Default

Hi Imar at last i had got the out put.I used proper web sharing and proper exception handling in the file So i had got It.any way i am very very thanks for you because you gave me a hint that there is a problem wih the security.Thanks very much Imar.

Bye-Ashok
 
Old December 12th, 2006, 03:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Actually, the FAQ only uses a database as an example. The Microsoft Access database (a file based database) could easily be replaced with an Image, a PDF file or an XML file. The principle stays the same: the IIS account is not allowed to write to the file or the folder where that file resides.

Maybe this one would have easier for you: http://www.spaanjaars.com/QuickDocId.aspx?quickdoc=290

Anyway, glad it's working now....

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Un Authorized Exception ashokparchuri XML 1 December 9th, 2006 10:50 AM
Un Authorized Exception ashokparchuri ASP.NET 1.0 and 1.1 Professional 1 December 8th, 2006 11:16 PM
Form view control, Authorized edit only nuttylife2 ASP.NET 2.0 Professional 0 July 10th, 2006 07:57 PM
Local WroxUnited - Not authorized to view page... willieb BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 November 20th, 2005 08:25 AM
Authorized site access quinn Classic ASP Basics 3 September 24th, 2003 02:33 AM





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