473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Access Denied For XML File

Hi

am Creating one web page in ASP.NET

and also implementing XML in my project am beginner to XML Creation

in my project i create XML document for every single Record in database table

I did this my level best

Its Run fine in local Environment

"But When i upload this page i can't get the XML document "

It will display the error like this "Access to the path 'C:\bay\passengers.xml' is denied."

"It doesn't create a XML file"

"In local Environment it works fine and also create every single record XML document"

This is my code for XML Creation

Expand|Select|Wrap|Line Numbers
  1. 1 Sub WriteXMl()
  2. 2
  3. 3 Dim strCurrentPath As String = Request.PhysicalPath
  4. 4 Dim strXMLPath As String = Left(strCurrentPath, InStrRev(strCurrentPath, "\")) & "passengers.xml"
  5. 5 Dim strConnect As String
  6. 6 Dim objXMLWriter As XmlTextWriter
  7. 7 Dim dbReader As OleDbDataReader
  8. 8 Dim xmldoc As New XmlDocument
  9. 9 Dim objDataSet As New DataSet
  10. 10 Try
  11. 11 objXMLWriter = New XmlTextWriter(strXMLPath, Nothing)
  12. 12 Catch objError As Exception
  13. 13 Exit Sub
  14. 14 End Try
  15. 15
  16. 16 strConnect = WebConfigurationManager.ConnectionStrings("Webbay").ConnectionString
  17. 17 Dim objConnect As New OleDbConnection(strConnect)
  18. 18 Dim command As New OleDbCommand("SELECT PassengerNo,FirstName,LastName,Marketing FROM bay", objConnect)
  19. 19 objConnect.Open()
  20. 20 dbReader = command.ExecuteReader
  21. 21
  22. 22 objXMLWriter.Formatting = Formatting.Indented
  23. 23 objXMLWriter.Indentation = 3
  24. 24 objXMLWriter.WriteStartDocument()
  25. 25 objXMLWriter.WriteComment("Created on " & Now())
  26. 26 objXMLWriter.WriteStartElement("TRAMSDATA")
  27. 27 objXMLWriter.WriteElementString("Version", "0.10-2.07.00")
  28. 28 objXMLWriter.WriteStartElement("PROFILE")
  29. 29 While dbReader.Read()
  30. 30 objXMLWriter.WriteStartElement("PASSENGER")
  31. 31 objXMLWriter.WriteElementString("PASSENGERNO", dbReader("PassengerNo"))
  32. 32 objXMLWriter.WriteElementString("FIRSTNAME", dbReader("FirstName"))
  33. 33 objXMLWriter.WriteElementString("LASTNAME", dbReader("LastName"))
  34. 34 objXMLWriter.WriteElementString("MARKETING", dbReader("Marketing"))
  35. 35 objXMLWriter.WriteEndElement()
  36. 36 End While
  37. 37
  38. 38 objXMLWriter.WriteEndElement()
  39. 39 objXMLWriter.WriteEndElement()
  40. 40 objXMLWriter.Flush()
  41. 41 objXMLWriter.Close()
  42. 42 dbReader.Close()
  43. 43 objDataSet.DataSetName = "TRAMSDATA"
  44. 44 objDataSet.Load(command.ExecuteReader(), LoadOption.OverwriteChanges, "PASSENGER")
  45. 45 objDataSet.WriteXmlSchema(Request.MapPath("passengers.xsd"))
  46. 46
  47. 47 End Sub
Can You help me

Please Very Urgent

Thanks With Regards

S.Senthil Nathan
Mar 25 '07 #1
1 1611
kenobewan
4,871 Expert 4TB
Web apps usually dont have access to local folders. If bay is set up as a directory through IIS you may a path using bay/passenger.xml. HTH.
Mar 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: calfdog | last post by:
Hello, Does anyone know a workaround for calling fireEvent. With the latest from Microsoft OS XP2 and Hot fixes to IE it now gives an "access denied" error in Python when called. Here is what...
6
by: ASP.Confused | last post by:
I have an ASP.NET page writtein in VB that uses ADODB. I just had to force-install MDAC 2.8 after I tried to rollback to 2.6 (my web host uses this, and I wanted to be compatible with them.) I...
0
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the...
16
by: Brad | last post by:
After compiling my asp.net project I'm receiving a "BC31011 - Access is denied" error when attempting to run or debug. The only thing that seems to resolve problem is IISReset. After a reset my...
12
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
3
by: Shailesh Humbad | last post by:
I figured out what was causing the "Access is Denied" error when calling functions from referenced DLLs in my service. I've tried to be very detailed, so bear with me. It turns out that...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
1
by: cpajoe2001 | last post by:
I am having an issue and after searching around online for a day and half now and finding others with the same problem but yet no solution to my issue I am looking for help. What i have is ServerA...
8
by: Jeremy Ames | last post by:
I am trying to move an application from my system to a new test system. I really should have tried an easier program first, but I didn't really have a chance. My application was originally written in...
0
by: Andy | last post by:
Thanks Peter, I thought I'd give an update on this problem. My application had 2 assemblies that contained classed for the Data access and business logic layer. It was on one of them that I was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.