XMLTextReader cannot read file from disk



Hi,
I have a problem creating an XMLTextReader from a file on disk. Its an ASP.NET application written in VS 2005.

When the application is deployed to IIS6 it runs fine but when run from visual studio the XMLTextReader is not populated from the file on the disk. I've checked that the file exists - it does.

I'm thinking its a permissions issue but I've given full control to the ASPNET user on the machine to the C drive, the windows folder and the folder when the file resides. Below is some of the code with comments explaning what its doing.
If anyone can advise on the permissions I would be really grateful.

string tempFolder = ConfigurationManager.AppS

Related to : XMLTextReader cannot read file from disk
Can't read from the source file or disk.
ASP & ASP.net

i get this problem in few of my files in hard disk, which is Disk D, first one is Disk C, any1 have cure for this, at first i only have this error in 1 file, now in 3 files, but these files are working perfectly, just cant copy paste.
Can't read from the source file or disk
ASP & ASP.net
I have 7GB Iso File in C and when i try to copy/cut it to the D i got this message:
Can't read from the source file or disk.
What's the best solution ?
"Cannot delete file: Cannot read from the source file or disk."
ASP & ASP.net

Hi

I am trying to delete a folder but I get the error message:

"Cannot delete file: Cannot read from the source file or disk."

I also cannot move, copy or cut & paste it.

I can, in the same location, create a folder with exactly the same name
(strange!) and then delete the old folder, but when I attempt to delete the new one, it has assumed the old folder's creation date, and I get the same error message.

I tried to use the save mode also cannot delete it . i used DOS to del i get the erro msg . "d: file not exist " but u can see the folder still there !!
In window Xp u can see it but unable to delete it .... any files copy inside th

Read disk file in to memory.
ASP & ASP.net

Hi all,

I have a disk file define as

TCHAR szTempFile[MAX_PATH];

What I want to do is, read that file into memory stream. To a buffer. How can I do it.


XMLTextReader cannot read file from disk
ASP & ASP.net

Hi,
I have a problem creating an XMLTextReader from a file on disk. Its an ASP.NET application written in VS 2005.

When the application is deployed to IIS6 it runs fine but when run from visual studio the XMLTextReader is not populated from the file on the disk. I've checked that the file exists - it does.

I'm thinking its a permissions issue but I've given full control to the ASPNET user on the machine to the C drive, the windows folder and the folder when the file resides. Below is some of the code with comments explaning what its doing.
If anyone can advise on the permissions I would be really grateful.

string tempFolder = ConfigurationManager.AppS
How can i update specific node with directory/ies/file/es using XmlTextWriter and XmlTextReader?
ASP & ASP.net

Today i have a class i'm using to build xml file of the treeView1 structure nodes using XmlTextWriter. Then i'm using XmlTextReader to load the xml file back to the treeView1 when i'm running my program each time.

The structure in the treeView1 is of my ftp server content. And instead getting each time i'm uploading/deleting a file all the ftp content from the server to update the treeView1 i decided to use the xml file for the updates.

This is the class of the xml:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Windows.Forms;

namespace FTP_ProgressBar
{
    class TreeViewXmlPopulation
    {
        private const string XmlNodeTag = "node";
        private const string XmlNodeTextAtt = "text";
        private const string XmlNodeTagAtt = "tag";
        private const string XmlNodeImageIndexAtt = "imageindex";

        public static void DeserializeTreeView(TreeView treeView,
string fileName)
        {
            XmlTextReader reader = null;
            try
            {
                treeView.BeginUpdate();
                reader = new XmlTextReader(fileName);
                TreeNode parentNode = null;
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.Name == XmlNodeTag)
                        {
                            TreeNode newNode = new TreeNode();
                            bool isEmptyElement =
reader.IsEmptyElement;

                            int attributeCount =
reader.AttributeCount;
                            if (attributeCount > 0)
                            {
                                for (int i = 0; i < attributeCount;
i++)
                                {
                                    reader.MoveToAttribute(i);
                                    SetAttributeValue(newNode,
                                                 reader.Name,
reader.Value);
                                }
                            }
                            if (parentNode != null)
                                parentNode.Nodes.Add(newNode);
                            else
                                treeView.Nodes.Add(newNode);

                            if (!isEmptyElement)
                            {
                                parentNode = newNode;
                            }
                        }
                    }
                    else if (reader.NodeType ==
XmlNodeType.EndElement)
                    {
                        if (reader.Name == XmlNodeTag)
                        {
                            parentNode = parentNode.Parent;
                        }
                    }
                    else if (reader.NodeType ==
XmlNodeType.XmlDeclaration)
                    {

                    }
                    else if (reader.NodeType == XmlNodeType.None)
                    {
                        return;
                    }
                    else if (reader.NodeType == XmlNodeType.Text)
                    {
                        parentNode.Nodes.Add(reader.Value);
                    }

                }
            }
            finally
            {
                treeView.EndUpdate();
                reader.Close();
            }
        }

        private static void SetAttributeValue(TreeNode node,
                           string propertyName, string value)
        {
            if (propertyName == XmlNodeTextAtt)
            {
                node.Text = value;
            }
            else if (propertyName == XmlNodeImageIndexAtt)
            {
                node.ImageIndex = int.Parse(value);
            }
            else if (propertyName == XmlNodeTagAtt)
            {
                node.Tag = value;
            }
        }

        public static void SerializeTreeView(TreeView treeView, string
fileName)
        {
            XmlTextWriter textWriter = new XmlTextWriter(fileName,
                                          System.Text.Encoding.ASCII);
            textWriter.WriteStartDocument();
            textWriter.WriteStartElement("TreeView");
            SaveNodes(treeView.Nodes, textWriter);

            textWriter.WriteEndElement();

            textWriter.Close();
        }

        private static void SaveNodes(TreeNodeCollection
nodesCollection,
   XmlTextWriter textWriter)
        {
            for (int i = 0; i < nodesCollection.Count; i++)
            {
                TreeNode node = nodesCollection[i];
                textWriter.WriteStartElement(XmlNodeTag);
                textWriter.WriteAttributeString(XmlNodeTextAtt,
                                                           node.Text);
                textWriter.WriteAttributeString(
                    XmlNodeImageIndexAtt, node.ImageIndex.ToString());
                if (node.Tag != null)
                    textWriter.WriteAttributeString(XmlNodeTagAtt,
                                                node.Tag.ToString()); 

                if (node.Nodes.Count > 0)
                {
                    SaveNodes(node.Nodes, textWriter);
                }
                textWriter.WriteEndElement();
            }
        }
    }
}

And i'm using it one with the Serialize when building the treeView1 structure in real time so it's building the xml file in real time:

treeView1.Nodes.Add(tn_rt);
TreeViewXmlPopulation.SerializeTreeView(treeView1,
@"c:XmlFileTest.xml");

Then when running the program i'm reading back the xml file in the constructor:

TreeViewXmlPopulation.DeserializeTreeView(treeView1,
@"c:XmlFileTest.xml");

This is working fine untill here.

Now i have a method where i'm uploading files could be single or multiple files to my ftp server. And i also create a new directory on my ftp server if the directory not exist already.

This is the top of my ftp upload method:

private void StringArrayUploadFiles(object sender,
DoWorkEventArgs e)
        {
            try
            {
                UploadedFiles = files;

UploadedFiles is string[]

public static string[] UploadedFiles { get; set; }

Then in the backgroundworker completed event in form1:

private void ftpProgress1_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.ToString(), "FTP error");
            }
            else
                if (e.Cancelled)
                {
                    this.toolStripStatusLabel1.Text = "Upload
Cancelled";
                }
                else
                {
                    string[] test = FtpProgress.UploadedFiles;
                    this.toolStripStatusLabel1.Text = "Upload
Completed";
                    TreeViewXmlPopulation.SerializeTreeView(treeView1,
@"c:XmlFileTest.xml");
                   
TreeViewXmlPopulation.DeserializeTreeView(treeView1,
@"c:XmlFileTest.xml");
                }
        }

For example in test i have single file let's say: d:myimage.jpg After the file uploaded fine and it's getting to the completed event i'm using a breakpoint and i see that test contain the uploaded file i need somehow to update the SerializeTreeView to add the file and if the directory is not exist also the directory to the exact place it was upload to my ftp server.

If for example it was uploaded to the root on my ftp server so the file also should apear on the treeView1 in the root. If it was uploaded to my server under directories d/test1/test2/myimage.jpg So the same in the treeView1 in root there should be a directory d/test1/test2/myimage.jpg

This is a screenshot of how my treeView1 looks like: The treeView1 with my ftp content is the right window.

treeView



HD Wallpapers
3D
3D Abstract
City
Celebrities
Indian Celebrities
Cars
Travel
Girls
Animals Birds
Movies
Sports
Black White
Nature
Planes
Anime
Food Drink
Dreamy Fantasy
Architecture
Games
Space
Holidays
Flowers
Love
Artistic
Baby
Beach
Bikes Motorcycles
Macro
Computers
Vector
Funny
Army
Textures
Brands
Misc
Music
Other
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .