 |
| 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
|
|
|
|

December 9th, 2006, 01:37 PM
|
|
Authorized User
|
|
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 9th, 2006, 01:48 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|
|

December 10th, 2006, 07:30 AM
|
|
Authorized User
|
|
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 10th, 2006, 07:33 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|
|

December 11th, 2006, 10:20 PM
|
|
Authorized User
|
|
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 11th, 2006, 10:32 PM
|
|
Authorized User
|
|
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 12th, 2006, 03:23 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|
|
 |