Click here to Skip to main content
15,886,806 members

Web Service gives error after changing version of .Net framework from 3.5 to 4.0

prasy123 asked:

Open original thread
I am creating an intranet application which needs the windows loginname. I am trying to retrieve the user id from System.Net.CredentialCache.DefaultNetworkCredentials and using this user Id to retrieve First and Last name of the user using the web service. It's worked fine in my localhost machine. But the problem is when I am trying to access the site from Development server it is showing the error:

The request failed with HTTP status 401: Access Denied

But the same code is working fine in Test environment.I don't have any idea why these both environment behaving differently. I am using windows Integrated authentication and Anonymous access disabled.

This application was in .net 3.5 and i changed to .net framework 4.0 version using VS2010. This web service is working perfectly in 3.5 version so my question is this version change will make any difference to web service?

Please help me to figure out this issue.

VB
Dim consumeWebService As ws-ProfileService
consumeWebService = New ws-ProfileService
consumeWebService.PreAuthenticate = True
consumeWebService.Credentials = System.Net.CredentialCache.DefaultNetworkCredential

HTML
Exception:
 The request failed with HTTP status 401: Unauthorized.
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 401: Unauthorized.

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 401: Unauthorized.]
   System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +2298
   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +345
   STOP.gov.cdc.activedirectory_ws.ProfileService.GetUserProfile(String UserID) in C:\Projects\STOP\STOP\Web References\gov.cdc.activedirectory-ws\Reference.vb:81
   STOP._Default.Page_Load(Object sender, EventArgs e) in C:\Projects\STOP\STOP\Default.aspx.vb:54

[WebException: Praseetha's findings]
   STOP._Default.Page_Load(Object sender, EventArgs e) in C:\Projects\STOP\STOP\Default.aspx.vb:107
   System.Web.UI.Control.LoadRecursive() +116
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2809


Thanks in advance
Tags: Visual Basic, ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900