Server Error in '/' Application.
The request failed with HTTP status 403: Forbidden.
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.Net.WebException: The request failed with HTTP status 403: Forbidden.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[WebException: The request failed with HTTP status 403: Forbidden.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1484609
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +221
NavWeb.WS_SalesInv.WS_SalesInvoice_Service.ReadMultiple(WS_SalesInvoice_Filter[] filter, String bookmarkKey, Int32 setSize) in C:\Users\JR\Documents\Visual Studio 2010\Projects\NavWeb\NavWeb\Web References\WS_SalesInv\Reference.cs:195
NavWeb.WebForm1.LoadDataGrid() in C:\Users\JR\Documents\Visual Studio 2010\Projects\NavWeb\NavWeb\WebForm1.aspx.cs:20
NavWeb.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Users\JR\Documents\Visual Studio 2010\Projects\NavWeb\NavWeb\WebForm1.aspx.cs:39
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
private void LoadDataGrid() { // Initialize the Service WS_Page_SalesInvHeader.WS_SalesInvoice_Service MySalesInvoicesService = new WS_Page_SalesInvHeader.WS_SalesInvoice_Service(); MySalesInvoicesService.UseDefaultCredentials = true; //Read Records WS_Page_SalesInvHeader.WS_SalesInvoice[] Invoices = MySalesInvoicesService.ReadMultiple(null, null, 0); //Fill Grid GridView1.DataSource = Invoices; GridView1.DataBind(); if (GridView1.Columns.Count > 0) GridView1.Columns[0].Visible = false; //Key else { GridView1.HeaderRow.Cells[0].Visible = false; foreach (GridViewRow gvr in GridView1.Rows) { gvr.Cells[0].Visible = false; } } }
Comments
Question is, why the request is "Forbidden". How looks your infrastructure? Where is the NST? Where SQL? Where is the Web application published? May be the problem is SPN and delegation...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
the .net website consuming the webservices is on an external hosted server.
Maybe its because the visual studio development machine is inside the domain it is working and the webserver is outside it doesnt work?
How can i configure it in the right way.
Thanx for your reply!
MySalesInvoicesService.UseDefaultCredentials
needs to be changed
NetCredentials is System.net.NetWorkCredentials
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Works great!!!!
=D> =D> =D>
your up for mvp2011.
Thanx,
Johan
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n