Invalid UNC path in my .NET applicaton

L

Luke

Microsoft Development Environment 2003 Version 7.1.3088
Microsoft .NET Framework 1.1 Version 1.1.4322
Windows 2000, version 5.0 (build 2195: Service Pack 4)

I am having problems loading xml stored as a blob in an Oracle
database.

I am getting the following error trying to display the xml object on
the page:

Server Error in '/PostFunding/Web' Application.
--------------------------------------------------------------------------------

The UNC path should be of the form \\server\share.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The UNC path should be of
the form \\server\share.

Source Error:

Line 158:
Line 159:
Line 160: xdoc.Load("C:\\prf_blob.xml");
Line 161:

Source File: c:\cc_views\xxx_pof_future_view\post_funding\source_code
\postfunding\web\secondary\pretell\displayblob.aspx.cs Line: 159

Stack Trace:

[ArgumentException: The UNC path should be of the form \\server
\share.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars, Char[] whitespaceChars, Char directorySeparator,
Char altDirectorySeparator, Char volumeSeparator, Boolean fullCheck,
String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy) +233
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share) +45
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials) +73
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role,
Type ofObjectToReturn) +55
System.Xml.Schema.DtdParser.ParseDocTypeDecl() +639
System.Xml.Schema.DtdParser.Parse() +61
System.Xml.XmlTextReader.ParseDtd(XmlScanner scanner) +71
System.Xml.XmlTextReader.ParseTag() +1379
System.Xml.XmlTextReader.ParseRoot() +234
System.Xml.XmlTextReader.Read() +127
System.Xml.XmlValidatingReader.ReadWithCollectTextToken() +146
System.Xml.XmlValidatingReader.Read() +26
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +31
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace) +102
System.Xml.XmlDocument.Load(XmlReader reader) +72
System.Xml.XmlDocument.Load(String filename) +78
Web.Secondary.Pretell.DisplayBlob.DisplayTheBlob(Byte[] blob,
String mimeType, String fileExtension) in c:\cc_views
\xxx_pof_future_view\post_funding\source_code\postfunding\web\secondary
\pretell\displayblob.aspx.cs:159

[Exception: blob exception]
Web.Secondary.Pretell.DisplayBlob.DisplayTheBlob(Byte[] blob,
String mimeType, String fileExtension) in c:\cc_views
\xxx_pof_future_view\post_funding\source_code\postfunding\web\secondary
\pretell\displayblob.aspx.cs:173
Web.Secondary.Pretell.DisplayBlob.Page_Load(Object sender,
EventArgs e) in c:\cc_views\xxx_pof_future_view\post_funding
\source_code\postfunding\web\secondary\pretell\displayblob.aspx.cs:105
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET Version:1.1.4322.573


Here is what I think are the relevant parts of the code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Web.Secondary.Pretell
{
public class DisplayBlob : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Xml Xml1;

private void Page_Load(object sender, System.EventArgs e)
{
code to get the blob works and is removed from here for
brevity...
DisplayTheBlob(blob);
}

private void DisplayTheBlob(byte[] blob)
{
try
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
ms.Write(blob, 0, blob.Length);
ms.Flush();
System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();

xdoc.Load("C:\\prf_blob.xml"); //UNC PATH ERROR HERE

// Create an XPathNavigator to use for the transform.
System.Xml.XPath.XPathNavigator nav =
xdoc.DocumentElement.CreateNavigator();
System.Xml.Xsl.XslTransform xsl = new
System.Xml.Xsl.XslTransform();
xsl.Load("C:\\FREDDIE\\FullFeedback_v3.0.xsl");
System.Xml.XmlTextWriter writer = new
System.Xml.XmlTextWriter("\\junk.xml", Encoding.UTF8);
xsl.Transform(nav, null, writer, null);
writer.Close();
Xml1.Transform = xsl;
Xml1.Document = xdoc;
}
catch (Exception e)
{
throw new Exception("blob exception" , e);
}
}


Here are the first few lines of the prf_blob.xml file:

<?xml version="1.0" ?><!DOCTYPE SERVICE_ORDER_RESPONSE SYSTEM "file:///
LOANPROSPECTOR_RESPONSE.3.0.DTD"><SERVICE_ORDER_RESPONSE
_Date="03-09-2007">
<KEY _Name="LOANPROSPECTOR_REQUEST" _Value="3.0"/>
<KEY _Name="LOANPROSPECTOR_RESPONSE" _Value="3.0"/>
<STATUS _Processing="Completed"/>

If I remove 'SYSTEM "file:///LOANPROSPECTOR_RESPONSE.3.0.DTD"' it
works as expected and displays the page in all of its multi-hued
glory :).
From everthing that I have been able to ascertain this is valid UNC
path syntax. Can anyone help me resolve this or explain why it is
being interpreted as invalid?

Removing 'SYSTEM "file:///LOANPROSPECTOR_RESPONSE.3.0.DTD"' from the
database blob is not an option for us since it is used extensively
across the enterprise outside of my .NET app.

If I can provide additional details to help with this, please let me
know.

TIA

Luke
 
L

Luke

Microsoft Development Environment 2003 Version 7.1.3088
Microsoft .NET Framework 1.1 Version 1.1.4322
Windows 2000, version 5.0 (build 2195: Service Pack 4)

I am having problems loading xml stored as a blob in an Oracle
database.

I am getting the following error trying to display the xml object on
the page:

Server Error in '/PostFunding/Web' Application.
---------------------------------------------------------------------------­-----

The UNC path should be of the form \\server\share.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The UNC path should be of
the form \\server\share.

Source Error:

Line 158:
Line 159:
Line 160: xdoc.Load("C:\\prf_blob.xml");
Line 161:

Source File: c:\cc_views\xxx_pof_future_view\post_funding\source_code
\postfunding\web\secondary\pretell\displayblob.aspx.cs Line: 159

Stack Trace:

[ArgumentException: The UNC path should be of the form \\server
\share.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars, Char[] whitespaceChars, Char directorySeparator,
Char altDirectorySeparator, Char volumeSeparator, Boolean fullCheck,
String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy) +233
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share) +45
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials) +73
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role,
Type ofObjectToReturn) +55
System.Xml.Schema.DtdParser.ParseDocTypeDecl() +639
System.Xml.Schema.DtdParser.Parse() +61
System.Xml.XmlTextReader.ParseDtd(XmlScanner scanner) +71
System.Xml.XmlTextReader.ParseTag() +1379
System.Xml.XmlTextReader.ParseRoot() +234
System.Xml.XmlTextReader.Read() +127
System.Xml.XmlValidatingReader.ReadWithCollectTextToken() +146
System.Xml.XmlValidatingReader.Read() +26
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +31
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace) +102
System.Xml.XmlDocument.Load(XmlReader reader) +72
System.Xml.XmlDocument.Load(String filename) +78
Web.Secondary.Pretell.DisplayBlob.DisplayTheBlob(Byte[] blob,
String mimeType, String fileExtension) in c:\cc_views
\xxx_pof_future_view\post_funding\source_code\postfunding\web\secondary
\pretell\displayblob.aspx.cs:159

[Exception: blob exception]
Web.Secondary.Pretell.DisplayBlob.DisplayTheBlob(Byte[] blob,
String mimeType, String fileExtension) in c:\cc_views
\xxx_pof_future_view\post_funding\source_code\postfunding\web\secondary
\pretell\displayblob.aspx.cs:173
Web.Secondary.Pretell.DisplayBlob.Page_Load(Object sender,
EventArgs e) in c:\cc_views\xxx_pof_future_view\post_funding
\source_code\postfunding\web\secondary\pretell\displayblob.aspx.cs:105
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

---------------------------------------------------------------------------­-----
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET Version:1.1.4322.573

Here is what I think are the relevant parts of the code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Web.Secondary.Pretell
{
public class DisplayBlob : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Xml Xml1;

private void Page_Load(object sender, System.EventArgs e)
{
code to get the blob works and is removed from here for
brevity...
DisplayTheBlob(blob);
}

private void DisplayTheBlob(byte[] blob)
{
try
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
ms.Write(blob, 0, blob.Length);
ms.Flush();
System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();

xdoc.Load("C:\\prf_blob.xml"); //UNC PATH ERROR HERE

// Create an XPathNavigator to use for the transform.
System.Xml.XPath.XPathNavigator nav =
xdoc.DocumentElement.CreateNavigator();
System.Xml.Xsl.XslTransform xsl = new
System.Xml.Xsl.XslTransform();
xsl.Load("C:\\FREDDIE\\FullFeedback_v3.0.xsl");
System.Xml.XmlTextWriter writer = new
System.Xml.XmlTextWriter("\\junk.xml", Encoding.UTF8);
xsl.Transform(nav, null, writer, null);
writer.Close();
Xml1.Transform = xsl;
Xml1.Document = xdoc;
}
catch (Exception e)
{
throw new Exception("blob exception" , e);
}
}

Here are the first few lines of the prf_blob.xml file:

<?xml version="1.0" ?><!DOCTYPE SERVICE_ORDER_RESPONSE SYSTEM "file:///
LOANPROSPECTOR_RESPONSE.3.0.DTD"><SERVICE_ORDER_RESPONSE
_Date="03-09-2007">
<KEY _Name="LOANPROSPECTOR_REQUEST" _Value="3.0"/>
<KEY _Name="LOANPROSPECTOR_RESPONSE" _Value="3.0"/>
<STATUS _Processing="Completed"/>

If I remove 'SYSTEM "file:///LOANPROSPECTOR_RESPONSE.3.0.DTD"' it
works as expected and displays the page in all of its multi-hued
glory :).
From everthing that I have been able to ascertain this is valid UNC

path syntax. Can anyone help me resolve this or explain why it is
being interpreted as invalid?

Removing 'SYSTEM "file:///LOANPROSPECTOR_RESPONSE.3.0.DTD"' from the
database blob is not an option for us since it is used extensively
across the enterprise outside of my .NET app.

If I can provide additional details to help with this, please let me
know.

TIA

Luke

I forgot to add: The location of LOANPROSPECTOR_RESPONSE.3.0.DTD is
C:\LOANPROSPECTOR_RESPONSE.3.0.DTD.

Luke
 
P

Patrice

What if you use an absolute path ?

IMO it could be related to the web application context in which the current
directory or drive doesn't really make sense...

--
Patrice


"Luke" <[email protected]> a écrit dans le message de (e-mail address removed)...
Microsoft Development Environment 2003 Version 7.1.3088
Microsoft .NET Framework 1.1 Version 1.1.4322
Windows 2000, version 5.0 (build 2195: Service Pack 4)

I am having problems loading xml stored as a blob in an Oracle
database.

I am getting the following error trying to display the xml object on
the page:

Server Error in '/PostFunding/Web' Application.
---------------------------------------------------------------------------­-----

The UNC path should be of the form \\server\share.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The UNC path should be of
the form \\server\share.

Source Error:

Line 158:
Line 159:
Line 160: xdoc.Load("C:\\prf_blob.xml");
Line 161:

Source File: c:\cc_views\xxx_pof_future_view\post_funding\source_code
\postfunding\web\secondary\pretell\displayblob.aspx.cs Line: 159

Stack Trace:

[ArgumentException: The UNC path should be of the form \\server
\share.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars, Char[] whitespaceChars, Char directorySeparator,
Char altDirectorySeparator, Char volumeSeparator, Boolean fullCheck,
String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy) +233
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share) +45
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials) +73
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role,
Type ofObjectToReturn) +55
System.Xml.Schema.DtdParser.ParseDocTypeDecl() +639
System.Xml.Schema.DtdParser.Parse() +61
System.Xml.XmlTextReader.ParseDtd(XmlScanner scanner) +71
System.Xml.XmlTextReader.ParseTag() +1379
System.Xml.XmlTextReader.ParseRoot() +234
System.Xml.XmlTextReader.Read() +127
System.Xml.XmlValidatingReader.ReadWithCollectTextToken() +146
System.Xml.XmlValidatingReader.Read() +26
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +31
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace) +102
System.Xml.XmlDocument.Load(XmlReader reader) +72
System.Xml.XmlDocument.Load(String filename) +78
Web.Secondary.Pretell.DisplayBlob.DisplayTheBlob(Byte[] blob,
String mimeType, String fileExtension) in c:\cc_views
\xxx_pof_future_view\post_funding\source_code\postfunding\web\secondary
\pretell\displayblob.aspx.cs:159

[Exception: blob exception]
Web.Secondary.Pretell.DisplayBlob.DisplayTheBlob(Byte[] blob,
String mimeType, String fileExtension) in c:\cc_views
\xxx_pof_future_view\post_funding\source_code\postfunding\web\secondary
\pretell\displayblob.aspx.cs:173
Web.Secondary.Pretell.DisplayBlob.Page_Load(Object sender,
EventArgs e) in c:\cc_views\xxx_pof_future_view\post_funding
\source_code\postfunding\web\secondary\pretell\displayblob.aspx.cs:105
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

---------------------------------------------------------------------------­-----
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET Version:1.1.4322.573

Here is what I think are the relevant parts of the code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Web.Secondary.Pretell
{
public class DisplayBlob : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Xml Xml1;

private void Page_Load(object sender, System.EventArgs e)
{
code to get the blob works and is removed from here for
brevity...
DisplayTheBlob(blob);
}

private void DisplayTheBlob(byte[] blob)
{
try
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
ms.Write(blob, 0, blob.Length);
ms.Flush();
System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();

xdoc.Load("C:\\prf_blob.xml"); //UNC PATH ERROR HERE

// Create an XPathNavigator to use for the transform.
System.Xml.XPath.XPathNavigator nav =
xdoc.DocumentElement.CreateNavigator();
System.Xml.Xsl.XslTransform xsl = new
System.Xml.Xsl.XslTransform();
xsl.Load("C:\\FREDDIE\\FullFeedback_v3.0.xsl");
System.Xml.XmlTextWriter writer = new
System.Xml.XmlTextWriter("\\junk.xml", Encoding.UTF8);
xsl.Transform(nav, null, writer, null);
writer.Close();
Xml1.Transform = xsl;
Xml1.Document = xdoc;
}
catch (Exception e)
{
throw new Exception("blob exception" , e);
}
}

Here are the first few lines of the prf_blob.xml file:

<?xml version="1.0" ?><!DOCTYPE SERVICE_ORDER_RESPONSE SYSTEM "file:///
LOANPROSPECTOR_RESPONSE.3.0.DTD"><SERVICE_ORDER_RESPONSE
_Date="03-09-2007">
<KEY _Name="LOANPROSPECTOR_REQUEST" _Value="3.0"/>
<KEY _Name="LOANPROSPECTOR_RESPONSE" _Value="3.0"/>
<STATUS _Processing="Completed"/>

If I remove 'SYSTEM "file:///LOANPROSPECTOR_RESPONSE.3.0.DTD"' it
works as expected and displays the page in all of its multi-hued
glory :).
From everthing that I have been able to ascertain this is valid UNC

path syntax. Can anyone help me resolve this or explain why it is
being interpreted as invalid?

Removing 'SYSTEM "file:///LOANPROSPECTOR_RESPONSE.3.0.DTD"' from the
database blob is not an option for us since it is used extensively
across the enterprise outside of my .NET app.

If I can provide additional details to help with this, please let me
know.

TIA

Luke

I forgot to add: The location of LOANPROSPECTOR_RESPONSE.3.0.DTD is
C:\LOANPROSPECTOR_RESPONSE.3.0.DTD.

Luke
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top