http-status-code-401

'Login as another user' MVC 4 Windows Authentication

旧街凉风 提交于 2019-11-28 05:32:56
I have an intranet project written in MVC 4 which uses Windows Authentication to authorise and authenticate users. I need to add a 'Login as another user' functionality. After some searching I found this solution which suggests returning a 401, and created the following Action (which is called using a form): // // POST: /Home/LogOut [HttpPost] [ValidateAntiForgeryToken] public ActionResult LogOut() { return new HttpUnauthorizedResult(); } The Action gets called, and the browser pops up a username and password window, however as the result redirects back to the Action, a 401 is always returned.

Spring RestTemplate invoking webservice with errors and analyze status code

最后都变了- 提交于 2019-11-28 03:50:01
I designed a webservice to perform a task if request parameters are OK, or return 401 Unauthorized HTTP status code if request parameters are wrong or empty. I'm using RestTemplate to perform a test and I'm able to verify the HTTP 200 OK status if the webservice replies with success. I am however unable to test for HTTP 401 error because RestTemplate itself throws an exception. My test method is @Test public void testUnauthorized() { Map<String, Object> params = new HashMap<String, Object>(); ResponseEntity response = restTemplate.postForEntity(url, params, Map.class); Assert.assertEquals

customerrors for 401.2 in ASP.NET

喜欢而已 提交于 2019-11-28 03:16:03
问题 I successfully implemented role based authorization in ASP.NET. When a person does not have the needed role he gets to see an error page for 401.2 not authorized. What I would like to accomplish now is to have a custom 401 page in my application and have it redirected there via settings in the web.config. I tried this: <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="401" redirect="NoAccess.htm" /> </customErrors> But this does not get caught. Do I

Google Drive Python API resumable upload error 401 after 2 hours

落花浮王杯 提交于 2019-11-28 02:00:50
First of all, I'm sorry if this is a too silly question... this is the first time I'm trying to use any of the technologies involved in this script (Python, the drive api, oauth 2.0, etc). I swear I've been searching and trying this for about a week before posting the question. hehehe I'm trying to use the google-api-python-client to upload a big file (3.5GiB) that is on a terminal only Linux Debian. I've had some success uploading small files, but when I try to upload the big file, the upload stops about 1~2 hours after it started with HTTP 401 error (unauthorized). I've been looking on how

401 Unauthorized error web api mvc windows authentication

白昼怎懂夜的黑 提交于 2019-11-28 00:49:50
问题 I am getting 401 unauthorized error . My web service is written in mvc . in IIS configured to use windows authentication. Below is screen shot of fiddler When I hit URL from browser it gives me popup window to enter user name and password. How can I avoid popup window? I am calling this web api from another window service. 回答1: I suspect that the two web services may be hosted on the same server. In this case, the problem may be caused by the loopback check. In order to test, try referencing

401 instead of 403 with Spring Boot 2

人盡茶涼 提交于 2019-11-27 23:09:11
With Spring Boot 1.5.6.RELEASE I was able to send HTTP Status code 401 instead of 403 as described in How let spring security response unauthorized(http 401 code) if requesting uri without authentication , by doing this: public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { //... http.exceptionHandling() .authenticationEntryPoint(new Http401AuthenticationEntryPoint("myHeader")); //... } } using the org.springframework.boot.autoconfigure.security.Http401AuthenticationEntryPoint class. I just upgraded to Spring

HTTP Status Code: 401 in GCMDemo

落爺英雄遲暮 提交于 2019-11-27 23:06:47
Reference:http://developer.android.com/google/gcm/demo.html Server 401 when trying to send a message to my android device. HTTP Status 500 - HTTP Status Code: 401 type Exception report message HTTP Status Code: 401 description The server encountered an internal error (HTTP Status Code: 401) that prevented it from fulfilling this request. exception com.google.android.gcm.server.InvalidRequestException: HTTP Status Code: 401 com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:177) com.google.android.gcm.server.Sender.send(Sender.java:121) com.google.android.gcm.demo.server

Server returned HTTP response code: 401 for URL: https

微笑、不失礼 提交于 2019-11-27 20:10:56
I'm using Java to access a HTTPS site which returns the display in an XML format. I pass the login credentials in the URL itself. Here is the code snippet: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); requestURL = "https://Administrator:Password@localhost:8443/abcd"; try { InputStream is = null; URL url = new URL(requestURL); InputStream xmlInputStream =new URL(requestURL).openConnection().getInputStream(); byte[] testByteArr = new byte[xmlInputStream.available()]; xmlInputStream.read(testByteArr); System.out.println(new

getting error java.io.IOException: Server returned HTTP response code: 401 for

醉酒当歌 提交于 2019-11-27 18:39:02
问题 Iam trying to authenticate to https url , but iam getting exception . Below is code. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSession;

Avoiding 401 response for each request using NTLM

此生再无相见时 提交于 2019-11-27 17:32:04
We have here an asp.net 3.5 application using NTLM based windows authentication. The system runs on a private network that actually distributed over different geographic places (connected via VPN). We are now trying to optimize the website's performance. Because the way NTLM works, every new request to the IIS is composed with 3 different requests while the first 2 is 401 responses. We are trying to minimize the amount of these requests to be only at the beginning of the session. We found this solution. Unfortunately it didn't change anything and we keep getting this 401 response (which