JayOnDotNet
JayOnDotNet

Reputation: 398

Access to the path 'c:\windows\system32\inetsrv\19.xml' is denied

I have a grid view on page. When i click on a select button of grid view. I am getting an exception like this

Error Message: Access to the path 'c:\windows\system32\inetsrv\19.xml' is denied. here 19 is the id of the record in the grid view.

Actually it was working fine till yesterday. but suddenly raised the exception.

Every thing here is done by a web service.Web service works fine on all pages but only on one page.The exception is raises only on production system not on development system

It is occurring on only one page. How to resolve this.

Upvotes: 0

Views: 17551

Answers (3)

KV Prajapati
KV Prajapati

Reputation: 94643

You need to use Server.MapPath if xml documents are located under the root of web-app.

string value="19.xml";
string file=Server.MapPath("~/folder/" + value);
...

Upvotes: 1

rofans91
rofans91

Reputation: 3010

Try to move your XML data to a DataTable.. hence remove neediness to access directly your file. When everything is done simply save back your changes into the respective xml file.

Upvotes: 0

Rickjaah
Rickjaah

Reputation: 591

Check your create/write/reading rights on the folder the xml is in.

Your application pool identity probably does not have the appropriate rights to create/modify/open the file, causing this error to occur.

Please check the security settings and see if that fixes the error.

Upvotes: 1

Related Questions