Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WebException: The remote server returned an error: (401) Unauthorized - Sharepoint

Posted on 2013-11-04
3
Medium Priority
?
1,174 Views
Last Modified: 2013-11-17
I got this error when accesing an xslt file. Here is the code. I get the above error at
"xsl.Load(xslURI) ". This is SP2013 and it is my vm box. I have administrative privelages. Looks like to me a security issue..


 Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
            Dim xmldoc As XmlDocument = New XmlDocument()
            Dim web As SPWeb = SPContext.Current.Web
            Dim list As SPList = web.Lists("Test")
            Dim li As SPListItem = list.GetItemById(CInt(Request.QueryString("ID")))
            xmldoc.LoadXml(li.Xml)
            Dim xslURI As String = web.Url & "/SiteAssets/TestDisplay.xsl"
            Dim xsl As XslCompiledTransform = New XslCompiledTransform()

            xsl.Load(xslURI)  
            Dim sb As StringBuilder = New StringBuilder()
            Dim sw As System.IO.StringWriter = New System.IO.StringWriter(sb)
            Dim xmlw As XmlTextWriter = New XmlTextWriter(sw)

            xsl.Transform(xmldoc, Nothing, xmlw)
            Server.HtmlDecode(sb.ToString.Replace("~siteurl", web.ServerRelativeUrl), writer)
        End Sub
    End Class
0
Comment
Question by:bujjigadu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Emmanuel Adebayo earned 1200 total points
ID: 39623509
The account that is running your application pool need to have access to the .xlst file you are trying to access remotely.

Are you using default networking service account for your application pool? you might need to create an account specific for this.

Regards
0
 

Author Comment

by:bujjigadu
ID: 39624422
I'm using administrative account for the app settings. I changed it to use local system but still get the same error.
0
 
LVL 18

Expert Comment

by:Emmanuel Adebayo
ID: 39626645
Sorry for not back to you before now.

Is the file you are trying to access on the same server? If not you have to grant the access/permission for the account where the file is located.

Regards
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question