System.IO.IOException: The filename, directory name, or volume label syntax is incorrect.

Discussion in 'ASP .Net' started by Trevor, Jul 26, 2004.

  1. Trevor

    Trevor Guest

    System.IO.IOException: The filename, directory name, or volume label
    syntax is incorrect.


    I have hit a problem for which I can find no solutions. Has anyone any
    ideas?

    I am writing XML into a Memory STream and using a Transform to make
    HTML. This works fine normally, but I have no the above stated error.

    I did get some odd chars in the HTML name which caused a problem,
    which I corrected. The current error seems to random. I am wondering
    if memory is the problem, or disk space.

    Last Trace - html 2-->../Grohe/Grohe-Sundries-Handles-Handles-Automatic-2000-47255000.html<--
    shows the filename

    Code:

    string HTMLName = xmlName;

    Trace.Warn ("html--" + HTMLName);


    string thisManNameDir = thisManName;
    thisManNameDir = thisManNameDir.Replace(" ","");

    HTMLName = "../" + thisManNameDir + "/" + HTMLName;
    Trace.Warn ("html 2-->" + HTMLName + "<--");
    //Trace.Warn("writing html" + HTMLName );
    XmlUrlResolver resolver = new XmlUrlResolver();



    string thisURL1 = Request.Url.ToString();
    Trace.Warn("header " + thisURL1);
    thisURL1 = thisURL1.Replace("/myxml/Xml1.aspx","");
    string thisURL = thisURL1.Replace("http://","");

    thisURL1 = thisURL1.Replace(".co.uk","");
    thisURL1 = thisURL1.Replace(".com","");
    thisURL1 = thisURL1.Replace(".biz","");

    thisURL1 = thisURL1.Replace("http://www.","");
    string thisDomain = thisURL1.Replace("http://","");

    NetworkCredential cred = new
    NetworkCredential(thisDomain,"pwd",thisURL);


    thisStream.Position = 0;
    Trace.Warn("a");
    //XmlTextReader myTxtReader = new XmlTextReader (thisStream);


    Trace.Warn("a1");
    string xslPath = Server.MapPath("myXSL.xsl");
    Trace.Warn("a2");
    string htmlPath = Server.MapPath(HTMLName);
    Trace.Warn("a3");
    XPathDocument aXPathDocument = new XPathDocument(thisStream);
    Trace.Warn("a4");
    XslTransform transform = new XslTransform();
    Trace.Warn("a5");
    transform.Load(xslPath, resolver);

    StreamWriter aStreamWriter = new StreamWriter(htmlPath);

    Trace.Warn("a6");


    transform.Transform(aXPathDocument,null,aStreamWriter, resolver);

    aStreamWriter.Flush();
    aStreamWriter.Close();




    Trace.Warn("a7");
    //Trace.Warn("ending html");

    }
    Trevor, Jul 26, 2004
    #1
    1. Advertising

  2. Trevor

    news Guest

    I solved this.

    "Trevor" <> wrote in message
    news:...
    > System.IO.IOException: The filename, directory name, or volume label
    > syntax is incorrect.
    >
    >
    > I have hit a problem for which I can find no solutions. Has anyone any
    > ideas?
    >
    > I am writing XML into a Memory STream and using a Transform to make
    > HTML. This works fine normally, but I have no the above stated error.
    >
    > I did get some odd chars in the HTML name which caused a problem,
    > which I corrected. The current error seems to random. I am wondering
    > if memory is the problem, or disk space.
    >
    > Last Trace - html

    2-->../Grohe/Grohe-Sundries-Handles-Handles-Automatic-2000-47255000.html<--
    > shows the filename
    >
    > Code:
    >
    > string HTMLName = xmlName;
    >
    > Trace.Warn ("html--" + HTMLName);
    >
    >
    > string thisManNameDir = thisManName;
    > thisManNameDir = thisManNameDir.Replace(" ","");
    >
    > HTMLName = "../" + thisManNameDir + "/" + HTMLName;
    > Trace.Warn ("html 2-->" + HTMLName + "<--");
    > //Trace.Warn("writing html" + HTMLName );
    > XmlUrlResolver resolver = new XmlUrlResolver();
    >
    >
    >
    > string thisURL1 = Request.Url.ToString();
    > Trace.Warn("header " + thisURL1);
    > thisURL1 = thisURL1.Replace("/myxml/Xml1.aspx","");
    > string thisURL = thisURL1.Replace("http://","");
    >
    > thisURL1 = thisURL1.Replace(".co.uk","");
    > thisURL1 = thisURL1.Replace(".com","");
    > thisURL1 = thisURL1.Replace(".biz","");
    >
    > thisURL1 = thisURL1.Replace("http://www.","");
    > string thisDomain = thisURL1.Replace("http://","");
    >
    > NetworkCredential cred = new
    > NetworkCredential(thisDomain,"pwd",thisURL);
    >
    >
    > thisStream.Position = 0;
    > Trace.Warn("a");
    > //XmlTextReader myTxtReader = new XmlTextReader (thisStream);
    >
    >
    > Trace.Warn("a1");
    > string xslPath = Server.MapPath("myXSL.xsl");
    > Trace.Warn("a2");
    > string htmlPath = Server.MapPath(HTMLName);
    > Trace.Warn("a3");
    > XPathDocument aXPathDocument = new XPathDocument(thisStream);
    > Trace.Warn("a4");
    > XslTransform transform = new XslTransform();
    > Trace.Warn("a5");
    > transform.Load(xslPath, resolver);
    >
    > StreamWriter aStreamWriter = new StreamWriter(htmlPath);
    >
    > Trace.Warn("a6");
    >
    >
    > transform.Transform(aXPathDocument,null,aStreamWriter, resolver);
    >
    > aStreamWriter.Flush();
    > aStreamWriter.Close();
    >
    >
    >
    >
    > Trace.Warn("a7");
    > //Trace.Warn("ending html");
    >
    > }
    news, Jul 26, 2004
    #2
    1. Advertising

  3. Trevor

    IIT Guy Guest

    IIT Guy, May 22, 2007
    #3
  4. "IIT Guy" <> wrote in message
    news:...
    > Hello. I know it's been almost 3 years since this post, but I'm
    > experiencing the same problem that you had and you're the only person who
    > seems to have an idea on how to fix it. Do you remember what your problem
    > was and how you resolved it?
    >


    The '..' characters are not allowed.
    Alexey Smirnov, May 23, 2007
    #4
  5. Peter Bromberg [C# MVP], May 8, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mike

    volume label

    mike, Feb 10, 2006, in forum: Java
    Replies:
    4
    Views:
    4,660
    Chris Smith
    Feb 11, 2006
  2. Bob Greschke

    Setting a drive's volume label

    Bob Greschke, Aug 3, 2005, in forum: Python
    Replies:
    3
    Views:
    635
    Bob Greschke
    Aug 5, 2005
  3. Replies:
    2
    Views:
    648
    Phill W.
    Aug 31, 2007
  4. Brian Wallace
    Replies:
    10
    Views:
    252
    Martin DeMello
    Apr 21, 2009
  5. Knut Krueger
    Replies:
    8
    Views:
    265
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page