EDN Admin
Well-known member
I have written a WCF service that takes an XML string from our client, adds the appropriate directives to it, converts it to an XmlDocument, and saves it to the appropriate folder. Once the load is complete, I check to make sure that the file is in
the correct format by loading its stylesheet, doing a quick transformation, and then deleting the resulting html file. The stylesheet is located on a different server than the XML document, so the permissions on the folders are not the same.
When I run the service through IIS with myself as the Identity for the ApplicationPool, it runs just fine. However, when I use our service user, I end up with an UnauthorizedAccessException on the XslCompiledTransform.Load(). The only difference
is the credentials in the ApplicationPool in IIS, so it is clearly a permissions issue. I have given the service user account full control on the stylesheet and then on the folder that contains the stylesheet. Obviously, this is NOT what I want
to do.
Is there a way to handle the Load while forcing some set up permissions on the file in code? I have tried using an XmlUrlResolver, but I have the same error whether I use DefaultCredentials or DefaultNetworkCredentials for the resolvers Credentials.
I have also not found any code that was helpful in determining what to do with the resolver other than set the Credentials and use it as a parameter in the Load. I added XsltSettings.TrustedXslt, but that made no difference either. The stylesheet
itself is very simple (I wrote it, so I know I am not missing anything hidden in there).
Thanks for your help in advance! <hr class="sig Christine A. Piffat
View the full article
the correct format by loading its stylesheet, doing a quick transformation, and then deleting the resulting html file. The stylesheet is located on a different server than the XML document, so the permissions on the folders are not the same.
When I run the service through IIS with myself as the Identity for the ApplicationPool, it runs just fine. However, when I use our service user, I end up with an UnauthorizedAccessException on the XslCompiledTransform.Load(). The only difference
is the credentials in the ApplicationPool in IIS, so it is clearly a permissions issue. I have given the service user account full control on the stylesheet and then on the folder that contains the stylesheet. Obviously, this is NOT what I want
to do.
Is there a way to handle the Load while forcing some set up permissions on the file in code? I have tried using an XmlUrlResolver, but I have the same error whether I use DefaultCredentials or DefaultNetworkCredentials for the resolvers Credentials.
I have also not found any code that was helpful in determining what to do with the resolver other than set the Credentials and use it as a parameter in the Load. I added XsltSettings.TrustedXslt, but that made no difference either. The stylesheet
itself is very simple (I wrote it, so I know I am not missing anything hidden in there).
Thanks for your help in advance! <hr class="sig Christine A. Piffat
View the full article