I know this has changed greatly since v1.0. I'm converting a small portion
of my application where I do a transformation.
The error happens on this line:
oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver);
ex.Message gives me: "Invalid Site"
ex.InnerException is empty
I've verified that XslPath + DataSourceName + ".xsl" is giving me the
correct path to the stylesheet in the format:
\\servername\e$\XslPath\StylesheetName.xsl
Here's my code
string ReportPath = ReportsFilePath + DataSourceName + TimePeriodSuffix
+ PreferredEmailFormat;
// Create a FileStream to write with
System.IO.FileStream oFileStream = new System.IO.FileStream(ReportPath,
System.IO.FileMode.Create);
// Create an XmlTextWriter for the FileStream
System.Xml.XmlTextWriter oXmlTextWriter = new
System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode);
try
{
// Create an XmlDataDocument from the ReportData DataSet parameter
XmlDataDocument oXmlDataDocument = new XmlDataDocument(ReportData);
// Set up the transformation
System.Xml.Xsl.XslTransform oXslTransform = new
System.Xml.Xsl.XslTransform();
// Load the Xsl and Transform
XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver();
oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials;
oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver);
// Xsl Path is class variable
oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter,
oXmlUrlResolver);
// Close the XmlTextWriter object
oXmlTextWriter.Close();
return ReportPath;
}
catch (System.Exception ex)
{
oXmlTextWriter.Close();
System.IO.File.Delete(ReportPath);
throw (ex);
} 11 1323
There must be some sort of rights issue. The code below works perfectly when
my Xsl is on a local drive, for example e:\Xsl\MyStyleSheet.Xsl
I get the "Invalid Site" error when my stylesheet is being referenced as
\\server\e$\Xsl\MyStyleSheet.Xsl
"George Durzi" <gd****@hotmail.com> wrote in message
news:eR**************@tk2msftngp13.phx.gbl... I know this has changed greatly since v1.0. I'm converting a small portion of my application where I do a transformation. The error happens on this line: oXslTransform.Load(XslPath + DataSourceName + ".xsl",
oXmlUrlResolver); ex.Message gives me: "Invalid Site" ex.InnerException is empty
I've verified that XslPath + DataSourceName + ".xsl" is giving me the correct path to the stylesheet in the format:
\\servername\e$\XslPath\StylesheetName.xsl
Here's my code
string ReportPath = ReportsFilePath + DataSourceName +
TimePeriodSuffix + PreferredEmailFormat; // Create a FileStream to write with System.IO.FileStream oFileStream = new
System.IO.FileStream(ReportPath, System.IO.FileMode.Create); // Create an XmlTextWriter for the FileStream System.Xml.XmlTextWriter oXmlTextWriter = new System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode);
try { // Create an XmlDataDocument from the ReportData DataSet parameter XmlDataDocument oXmlDataDocument = new XmlDataDocument(ReportData);
// Set up the transformation System.Xml.Xsl.XslTransform oXslTransform = new System.Xml.Xsl.XslTransform();
// Load the Xsl and Transform XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver(); oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials; oXslTransform.Load(XslPath + DataSourceName + ".xsl",
oXmlUrlResolver); // Xsl Path is class variable oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter, oXmlUrlResolver);
// Close the XmlTextWriter object oXmlTextWriter.Close();
return ReportPath; } catch (System.Exception ex) { oXmlTextWriter.Close(); System.IO.File.Delete(ReportPath); throw (ex); }
It sounds like the UNC share doesn't know or recognize the ASPNET account or
whoever it is impersonating. You might want to check the permissions on the
share.
"George Durzi" <gd****@hotmail.com> wrote in message
news:u9**************@TK2MSFTNGP10.phx.gbl... There must be some sort of rights issue. The code below works perfectly
when my Xsl is on a local drive, for example e:\Xsl\MyStyleSheet.Xsl
I get the "Invalid Site" error when my stylesheet is being referenced as \\server\e$\Xsl\MyStyleSheet.Xsl
"George Durzi" <gd****@hotmail.com> wrote in message news:eR**************@tk2msftngp13.phx.gbl... I know this has changed greatly since v1.0. I'm converting a small
portion of my application where I do a transformation. The error happens on this line: oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver); ex.Message gives me: "Invalid Site" ex.InnerException is empty
I've verified that XslPath + DataSourceName + ".xsl" is giving me the correct path to the stylesheet in the format:
\\servername\e$\XslPath\StylesheetName.xsl
Here's my code
string ReportPath = ReportsFilePath + DataSourceName + TimePeriodSuffix + PreferredEmailFormat; // Create a FileStream to write with System.IO.FileStream oFileStream = new System.IO.FileStream(ReportPath, System.IO.FileMode.Create); // Create an XmlTextWriter for the FileStream System.Xml.XmlTextWriter oXmlTextWriter = new System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode);
try { // Create an XmlDataDocument from the ReportData DataSet parameter XmlDataDocument oXmlDataDocument = new XmlDataDocument(ReportData);
// Set up the transformation System.Xml.Xsl.XslTransform oXslTransform = new System.Xml.Xsl.XslTransform();
// Load the Xsl and Transform XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver(); oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials; oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver); // Xsl Path is class variable oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter, oXmlUrlResolver);
// Close the XmlTextWriter object oXmlTextWriter.Close();
return ReportPath; } catch (System.Exception ex) { oXmlTextWriter.Close(); System.IO.File.Delete(ReportPath); throw (ex); }
The ASPNET account has full control of the whole virtual directory and I am
still experiencing this error :(
Back to square one.
"Oliver" <DE*******************@hotmail.com> wrote in message
news:OZ**************@tk2msftngp13.phx.gbl... It sounds like the UNC share doesn't know or recognize the ASPNET account
or whoever it is impersonating. You might want to check the permissions on
the share.
"George Durzi" <gd****@hotmail.com> wrote in message news:u9**************@TK2MSFTNGP10.phx.gbl... There must be some sort of rights issue. The code below works perfectly when my Xsl is on a local drive, for example e:\Xsl\MyStyleSheet.Xsl
I get the "Invalid Site" error when my stylesheet is being referenced as \\server\e$\Xsl\MyStyleSheet.Xsl
"George Durzi" <gd****@hotmail.com> wrote in message news:eR**************@tk2msftngp13.phx.gbl... I know this has changed greatly since v1.0. I'm converting a small portion of my application where I do a transformation. The error happens on this line: oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver); ex.Message gives me: "Invalid Site" ex.InnerException is empty
I've verified that XslPath + DataSourceName + ".xsl" is giving me the correct path to the stylesheet in the format:
\\servername\e$\XslPath\StylesheetName.xsl
Here's my code
string ReportPath = ReportsFilePath + DataSourceName + TimePeriodSuffix + PreferredEmailFormat; // Create a FileStream to write with System.IO.FileStream oFileStream = new System.IO.FileStream(ReportPath, System.IO.FileMode.Create); // Create an XmlTextWriter for the FileStream System.Xml.XmlTextWriter oXmlTextWriter = new System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode);
try { // Create an XmlDataDocument from the ReportData DataSet
parameter XmlDataDocument oXmlDataDocument = new
XmlDataDocument(ReportData); // Set up the transformation System.Xml.Xsl.XslTransform oXslTransform = new System.Xml.Xsl.XslTransform();
// Load the Xsl and Transform XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver(); oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials; oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver); // Xsl Path is class variable oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter, oXmlUrlResolver);
// Close the XmlTextWriter object oXmlTextWriter.Close();
return ReportPath; } catch (System.Exception ex) { oXmlTextWriter.Close(); System.IO.File.Delete(ReportPath); throw (ex); }
But is ASP.NET impersonating someone who doesn't have rights... like the
IUSR_<machinename> account?
"George Durzi" <gd****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl... The ASPNET account has full control of the whole virtual directory and I
am still experiencing this error :(
Back to square one.
"Oliver" <DE*******************@hotmail.com> wrote in message news:OZ**************@tk2msftngp13.phx.gbl... It sounds like the UNC share doesn't know or recognize the ASPNET
account or whoever it is impersonating. You might want to check the permissions on the share.
"George Durzi" <gd****@hotmail.com> wrote in message news:u9**************@TK2MSFTNGP10.phx.gbl... There must be some sort of rights issue. The code below works
perfectly when my Xsl is on a local drive, for example e:\Xsl\MyStyleSheet.Xsl
I get the "Invalid Site" error when my stylesheet is being referenced
as \\server\e$\Xsl\MyStyleSheet.Xsl
"George Durzi" <gd****@hotmail.com> wrote in message news:eR**************@tk2msftngp13.phx.gbl... > I know this has changed greatly since v1.0. I'm converting a small portion > of my application where I do a transformation. > The error happens on this line: > oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver); > ex.Message gives me: "Invalid Site" > ex.InnerException is empty > > I've verified that XslPath + DataSourceName + ".xsl" is giving me
the > correct path to the stylesheet in the format: > > \\servername\e$\XslPath\StylesheetName.xsl > > Here's my code > > string ReportPath = ReportsFilePath + DataSourceName + TimePeriodSuffix > + PreferredEmailFormat; > // Create a FileStream to write with > System.IO.FileStream oFileStream = new System.IO.FileStream(ReportPath, > System.IO.FileMode.Create); > // Create an XmlTextWriter for the FileStream > System.Xml.XmlTextWriter oXmlTextWriter = new > System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode); > > try > { > // Create an XmlDataDocument from the ReportData DataSet parameter > XmlDataDocument oXmlDataDocument = new XmlDataDocument(ReportData); > > // Set up the transformation > System.Xml.Xsl.XslTransform oXslTransform = new > System.Xml.Xsl.XslTransform(); > > // Load the Xsl and Transform > XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver(); > oXmlUrlResolver.Credentials =
CredentialCache.DefaultCredentials; > oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver); > // Xsl Path is class variable > oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter, > oXmlUrlResolver); > > // Close the XmlTextWriter object > oXmlTextWriter.Close(); > > return ReportPath; > } > catch (System.Exception ex) > { > oXmlTextWriter.Close(); > System.IO.File.Delete(ReportPath); > throw (ex); > } > >
This is actually a Console application. Would Console applications also run
as the ASPNET account?
"Oliver" <DE*******************@hotmail.com> wrote in message
news:OU**************@TK2MSFTNGP10.phx.gbl... But is ASP.NET impersonating someone who doesn't have rights... like the IUSR_<machinename> account?
"George Durzi" <gd****@hotmail.com> wrote in message news:%2***************@TK2MSFTNGP11.phx.gbl... The ASPNET account has full control of the whole virtual directory and I am still experiencing this error :(
Back to square one.
"Oliver" <DE*******************@hotmail.com> wrote in message news:OZ**************@tk2msftngp13.phx.gbl... It sounds like the UNC share doesn't know or recognize the ASPNET account or whoever it is impersonating. You might want to check the permissions
on the share.
"George Durzi" <gd****@hotmail.com> wrote in message news:u9**************@TK2MSFTNGP10.phx.gbl... > There must be some sort of rights issue. The code below works perfectly when > my Xsl is on a local drive, for example e:\Xsl\MyStyleSheet.Xsl > > I get the "Invalid Site" error when my stylesheet is being
referenced as > \\server\e$\Xsl\MyStyleSheet.Xsl > > "George Durzi" <gd****@hotmail.com> wrote in message > news:eR**************@tk2msftngp13.phx.gbl... > > I know this has changed greatly since v1.0. I'm converting a small portion > > of my application where I do a transformation. > > The error happens on this line: > > oXslTransform.Load(XslPath + DataSourceName + ".xsl", > oXmlUrlResolver); > > ex.Message gives me: "Invalid Site" > > ex.InnerException is empty > > > > I've verified that XslPath + DataSourceName + ".xsl" is giving me the > > correct path to the stylesheet in the format: > > > > \\servername\e$\XslPath\StylesheetName.xsl > > > > Here's my code > > > > string ReportPath = ReportsFilePath + DataSourceName + > TimePeriodSuffix > > + PreferredEmailFormat; > > // Create a FileStream to write with > > System.IO.FileStream oFileStream = new > System.IO.FileStream(ReportPath, > > System.IO.FileMode.Create); > > // Create an XmlTextWriter for the FileStream > > System.Xml.XmlTextWriter oXmlTextWriter = new > > System.Xml.XmlTextWriter(oFileStream,
System.Text.Encoding.Unicode); > > > > try > > { > > // Create an XmlDataDocument from the ReportData DataSet parameter > > XmlDataDocument oXmlDataDocument = new XmlDataDocument(ReportData); > > > > // Set up the transformation > > System.Xml.Xsl.XslTransform oXslTransform = new > > System.Xml.Xsl.XslTransform(); > > > > // Load the Xsl and Transform > > XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver(); > > oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials; > > oXslTransform.Load(XslPath + DataSourceName + ".xsl", > oXmlUrlResolver); > > // Xsl Path is class variable > > oXslTransform.Transform(oXmlDataDocument, null,
oXmlTextWriter, > > oXmlUrlResolver); > > > > // Close the XmlTextWriter object > > oXmlTextWriter.Close(); > > > > return ReportPath; > > } > > catch (System.Exception ex) > > { > > oXmlTextWriter.Close(); > > System.IO.File.Delete(ReportPath); > > throw (ex); > > } > > > > > >
Hi George,
I think a console application would run as the logged on user unless
configured to run as someone else.
"George Durzi" <gd****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... This is actually a Console application. Would Console applications also
run as the ASPNET account?
I'm running the Console app on my machine in debug mode logged on with my
user id which is an enterprise admin on our domain.
When I point to my test Xsls locally on my machine (they're accessible at
e:\inetpub\wwwroot\MyApp\Xsl) everything runs fine. But when I switch to my
production Xsls accessible at \\server\e$\inetpub\etc ... I get that error.
I'll play around with it a little more tomorrow having it run under
different Ids. I'll post my success/failure here.
Amazing how this damn XmlResolver has turned 1 line of code into 5
"Oliver" <DE*******************@hotmail.com> wrote in message
news:eI**************@TK2MSFTNGP11.phx.gbl... Hi George,
I think a console application would run as the logged on user unless configured to run as someone else.
"George Durzi" <gd****@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... This is actually a Console application. Would Console applications also run as the ASPNET account?
..NET 1.1 changed how XslTransform handles security. If I understand the docs
correctly, .NET 1.0 ran XSLT's (scripts embedded in XSLT's, access from
document() Xpath function, etc.) in a fully-trusted way. .NET 1.1 restricts
the level of trust by default. Remote files are less trusted than local
files, so you may be getting a security error because of that.
If you trust the remote XSLT, you give XsltTransform the same level of trust
as the calling assembly by passing this.GetType().Assembly.Evidence to the
evidence parameter of the Load method.
"Oliver" <DE*******************@hotmail.com> wrote in message
news:eI**************@TK2MSFTNGP11.phx.gbl... Hi George,
I think a console application would run as the logged on user unless configured to run as someone else.
"George Durzi" <gd****@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... This is actually a Console application. Would Console applications also run as the ASPNET account?
Bret and Oliver
Thank you both for your help. I've gotten this to work.
"Bret Mulvey [MS]" <br***@online.microsoft.com> wrote in message
news:BC6tb.1329$Dw6.12720@attbi_s02... .NET 1.1 changed how XslTransform handles security. If I understand the
docs correctly, .NET 1.0 ran XSLT's (scripts embedded in XSLT's, access from document() Xpath function, etc.) in a fully-trusted way. .NET 1.1
restricts the level of trust by default. Remote files are less trusted than local files, so you may be getting a security error because of that.
If you trust the remote XSLT, you give XsltTransform the same level of
trust as the calling assembly by passing this.GetType().Assembly.Evidence to the evidence parameter of the Load method.
"Oliver" <DE*******************@hotmail.com> wrote in message news:eI**************@TK2MSFTNGP11.phx.gbl... Hi George,
I think a console application would run as the logged on user unless configured to run as someone else.
"George Durzi" <gd****@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... This is actually a Console application. Would Console applications
also run as the ASPNET account?
Good to hear that George. What was it?
"George Durzi" <gd****@hotmail.com> wrote in message
news:OS**************@TK2MSFTNGP09.phx.gbl... Bret and Oliver Thank you both for your help. I've gotten this to work. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Anthony Bouch |
last post by:
Can anyone tell me why I receive the following compiler warning after having
recently upgraded to VS.Net 2003 and .Net 1.1?
Warning CS0618: 'System.Xml.Xsl(System.Xml.XPath.IXPathNavigable,...
|
by: Rodger McNab |
last post by:
While parsing xpath expressions within an XSLT document the .NET
XslTransform class seems to delete the first "/" after a "]" within an
expression containing a "|". This problem can be demonstrated...
|
by: Graham Pengelly |
last post by:
Hi
I am trying to transform on System.Xml.XmlDocument into another using
XslTransform without writing the object out to a file. I am guessing it
should work something like this...
public...
|
by: Steve |
last post by:
Is there any way of specifying the startMode when using the xslTransform class?
We are updating code which used msxml to the system.xml classes but can find
no way to specify the startMode.
We...
|
by: shell shell via .NET 247 |
last post by:
How do you get the underlying Xslt stylesheet content from an XslTransform object that has been created and loaded with a stylesheet file or some text?
Assume a method will create an XslTransform...
|
by: manlio |
last post by:
how can I load a XSL string (not an xsl file!!) with XslTransform ???
If I use the code:
// Create a new XslTransform class and load the stylesheet
XslTransform myXslTransform = new...
|
by: David S. Alexander |
last post by:
I am trying to transform XML to XML using an XSLT in C#, but the root node
of my XML is not being matched by the XSLT if it has an xmlns attribute. Am
I handling my namespaces incorrectly?
My C#...
|
by: rmgalante |
last post by:
Hello,
I have a VB.Net component that uses the XslTransform object. I am using
the FXSL randomizeList function in my XSL template. When I transform
the XML in the VB.Net component, my...
|
by: Praveen |
last post by:
Have a common function in Javascript which do transform for all .xsl's.
XSL object is loaded like this.
var xslobj=new ActiveXObject("MSXML2.FreeThreadedDOMDocument.4.0");
xslobj.async = false;...
|
by: WT |
last post by:
Hello,
I have code created with .net 1.0 and migrated to 3.5.
Form 2.0 the XslTransform class is obsolete and the vs2008 compiler
generates warnings that these classes are absolete suggesting to...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
| |