http-status-code-401

Sending message with 401: Asp.net Web-api

萝らか妹 提交于 2019-12-10 13:28:51
问题 I am in asp.net web API. In login method I check the user/password against the db and if they do not match, I return 401 status code along with invalid user or password method like var content = new StringContent("Invalid user name or password"); var message = new HttpResponseMessage(HttpStatusCode.Unauthorized); message.Content = content; throw new HttpResponseException(message); But API seems to ignore my message and simply return some HTML like <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0

Service-Worker, “TypeError:Request failed at <anonymous>”

不想你离开。 提交于 2019-12-09 17:29:52
问题 I hope you can help me with my problem. Currently I build a PWA with a service-worker. It registerd successful, but something is wrong with the installation. The "caches.open"-promise result in an error: "TypeError: Request failed at ". You can see in Chrome, that the cache is registerd, but empty. I already checked the cache urls thousand times.. Here is my Service-worker Code var CACHE_NAME = 'surv-cache-1'; var resourcesToCache = [ '/', '/index.html', '/jquery-3.2.1.min.js', '/pouchdb.min

.NET core returning 500 instead of 401 when missing cookie

感情迁移 提交于 2019-12-08 23:32:31
I have a .NET core API that uses cookie authentication. It is accessed by a PWA/SPA that has its own login route. In Startup.cs : public void ConfigureServices(IServiceCollection services) { ... services.AddIdentity<MyUser, MyRole>(options => { ... // Use cookie authentication var expiresIn = new TimeSpan(1, 0, 0); // 1 hour timeout var c = options.Cookies.ApplicationCookie; c.AuthenticationScheme = "appSchemeName"; c.CookieName = "appCookieName"; c.AutomaticAuthenticate = true; // If this is true auth failures become redirects c.AutomaticChallenge = false; c.SlidingExpiration = true; c

401 error while using tweepy

。_饼干妹妹 提交于 2019-12-08 16:27:05
问题 I am running the below program.But am getting the below error Message. 401 **** 401 **** (keeps on repeating) The code(got from some forum) basically tries to connect to Twitter and fetch tweets. When its ran on ubuntu terminal the 401 error message appear. import sys import json import pymongo import tweepy consumer_key="XX" ##all the keys and codes have to be strings consumer_secret="XX" access_token = "XX" access_token_secret = "XX" # This is the listener, resposible for receiving data

Why my httpwebrequest post to myhandler.ashx is rejected with status code 401

南笙酒味 提交于 2019-12-08 11:14:36
I've already written an HTTPHandler that gets POSTed from a ColdFusion page and it works successfully; now, I am trying to write a web application in ASP.NET so I can post a form to the .ashx handler from an .aspx page. Application Trace (trace.axd) shows the following as my last 3 entries: 2 8/14/2009 1:53:56 PM /Default.aspx 200 GET View Details 3 8/14/2009 1:54:04 PM /Default.aspx 200 POST View Details 4 8/14/2009 1:54:13 PM /UploadHandler.ashx 401 POST View Details I have a breakpoint in my .ashx file but it is never reached (I guess because of the 401 status code). Here is the snippet of

C# WebClient HTTP Basic Authentication Failing 401 with Correct Credentials

百般思念 提交于 2019-12-08 10:50:34
I'm trying to automate configuring a wireless router's SSID and Password via c# webclient . The router has no API that I know of. It's an unbranded chinese router. The web config seems to be the only option for configuration. It uses http-basic-authentication (you browse to the IP address of the router and get a generic dialog asking for username and password). I've used Wireshark to get the headers and form fields that the http-post requests use when I manually update the SSID and Password (two separate forms). I then attempted to use webclient to emulate those post requests. Here is a

C# WebClient HTTP Basic Authentication Failing 401 with Correct Credentials

£可爱£侵袭症+ 提交于 2019-12-08 07:44:42
问题 I'm trying to automate configuring a wireless router's SSID and Password via c# webclient. The router has no API that I know of. It's an unbranded chinese router. The web config seems to be the only option for configuration. It uses http-basic-authentication (you browse to the IP address of the router and get a generic dialog asking for username and password). I've used Wireshark to get the headers and form fields that the http-post requests use when I manually update the SSID and Password

HttpURLConnnection request failures on Android 6.0 (MarshMallow)

自作多情 提交于 2019-12-08 05:31:56
问题 I am using Google's Volley library for my application project , that targets minimum api level 14.So, Volley library uses HttpURLConnection as the NetworkClient. Therefore , there should not be any issue related to Removal of Apache HTTPClient. However, I have done the configuration required for 6.0 Sdk i.e compileSdkVersion 23, build-tool-version 23.0.1 and build:gradle:1.3.1' and even tried adding useLibrary 'org.apache.http.legacy'. Have updated the same for Volley library project in my

Best way to handle unauthenticated request in asp.net Web Api

五迷三道 提交于 2019-12-08 04:34:30
问题 I have a standard VS2013 MVC5 project with a Web Api 2 in it. The way the standard project is designed, the [Authorize] attributes simply return a 401 status code if the request is not authenticated, while a totally separate module sniffs for any 401 codes, halts them, and instead sends a 302 redirect to the login page specified in the Startup.Auth.cs file. That's ok for Mvc controllers, but really stinks for Web Api controllers because for example browsers will automatically redirect ajax

Oracle ADF Secured App Gives HTTP 401 Error

落爺英雄遲暮 提交于 2019-12-07 23:01:40
问题 I am new to Oracle ADF Framework. I develop on JDeveloper 11g R2 with Weblogic 10.3.5.0. I developed an project like described in a Firebox training video on Youtube. You can download my project from here The video was about creating a custome login page. You have to create login,error anad the target pages. When you try to open target page login page comes then you enter your credentials. After success yoou should be directed to the target page. I used a backing bean to process credentials