http-status-code-403

Asp.Net web service: I would like to return error 403 forbidden

二次信任 提交于 2019-11-27 08:34:54
I have got a web service programmed in c# / asp.net. [WebService(Namespace = "http://example.com/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ScriptService] [System.ComponentModel.ToolboxItem(false)] public class Service: System.Web.Services.WebService { [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public Result GetData() { User user = GetUser(); if (user.LoggedIn) { return GetData(); } else { // raise exception -> return error 403 } } How is it possible to return error 403 out of this web service? I can throw an exception - but this shows the exeption

System.Net.WebClient request gets 403 Forbidden but browsers do not with Apache servers

♀尐吖头ヾ 提交于 2019-11-27 07:51:23
问题 An odd one, I'm trying to read the <Head> section of a lot of different websites out there, and one particular type of server, Apache, sometimes gives the code 403 forbidden. Not all apache servers do this, so it may be a config setting or a particular version of the server. When I then check the url with a web browser (Firefox, for example) the page loads fine. The code sorta looks like this: var client = new WebClient(); var stream = client.OpenRead(new Uri("http://en.wikipedia.org/wiki

HttpURLConnection reading response content on 403 error [duplicate]

最后都变了- 提交于 2019-11-27 07:43:28
问题 This question already has an answer here: Read error response body in Java 7 answers When I fetch data from an URL with a 403 response is = conn.getInputStream(); It throws an IOException and I can't get the response data. But when I use firefox and access that url directly, The ResponseCode is still 403, but I can get the html content 回答1: The HttpURLConnection.getErrorStream method will return an InputStream which can be used to retrieve data from error conditions (such as a 404), according

Recieving a 403 forbidden error when using latitude and longitude: geocoding

寵の児 提交于 2019-11-27 05:30:14
Our site has the option to insert your postcode in, which in turn works with geocoding to work out the latitude and longitude. This code has not been changed for years but today if the user trys to insert a postcode or update it from yesterday or before the error 'The remote server returned an error: (403) Forbidden.' pops up. The requests have not shot past 2,500 so I cant see Google blocking us because of that.. Any ideas?? The version 2 Geocoding API was turned off September 9th as announced... From Upgrading Your Geocoding API Application To v3 Version 2 ("v2") of the Geocoding API was

Can't access /elmah on production server with Elmah MVC?

China☆狼群 提交于 2019-11-27 05:26:57
问题 I installed the elmah.mvc nuget package and kept the default configuration of that sans setting up sending an email and plugging it into a SQL database. On my local machine when I use the Visual Studio host, I can open my app and access /elmah fine to see a report of the errors. However, when I try and access /elmah on production, I get two errors, first I get a 403 access is denied server error. Then in my email (from elmah) I get: System.Web.HttpException: Server cannot set status after

403 Forbidden message when calling the v3 Google Calendar API using a Service Account via OAuth 2.0

霸气de小男生 提交于 2019-11-27 05:08:01
This is a follow on from my thread about a 401 error when using the Google Calendar API and OAuth2, which can be found here This contains details of the account setup that leads onto my next question, so I wont repeat myself in this thread. OK, so when when I call the following code to update a Calendar event I get a 403 forbidden error. for (Event event : events.getItems()) { event.setSummary("XXX" + event.getSummary()); Event updatedEvent = calendar.events().update(CALENDAR_ID, event.getId(), event).execute(); } Here is the returned error message: com.google.api.client.googleapis.json

Forbidden Error 403 On Server Folder

大兔子大兔子 提交于 2019-11-27 04:53:54
问题 I'm trying to host a new blog where I can add posts using a simple HTML form & PHP script. When I test out the form on my localhost everything works fine, but when I upload it and test it live I get: Forbidden You don't have permission to access /php/add-post.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. I know that my host allows this type of script because I'm using exactly the same thing on another blog,

Mutual certificates authentication fails with error 403.16

99封情书 提交于 2019-11-27 04:19:26
问题 I'm using Windows Server 2012 and IIS 8.5. I've set SSL for the website and the SSL Settings are: Require Required and Require Client Certificates. The client certificate that I'm sending to the server has been issued by a self-signed authority (let's called it MyCompany CA). MyCompany CA certificate has been successfully installed in the Local Computer Account - Trusted Root Certification Authorities. It's expiration date is 2039, so is the client certificate expiration date. However, with

jQuery AJAX call results in error status 403

断了今生、忘了曾经 提交于 2019-11-27 01:59:59
问题 I'm making a query to a web service using jQuery AJAX. My query looks like this: var serviceEndpoint = 'http://example.com/object/details?version=1.1'; $.ajax({ type: 'GET', url: serviceEndpoint, dataType: 'jsonp', contentType: 'jsonp', headers: { 'api-key':'myKey' }, success: onSuccess, error: onFailure }); When I execute this, I get a status error of 403. I do not understand why my call results in having the status code 403. I'm in control of the security on my service and it is marked as

Is there a way to force apache to return 404 instead of 403?

▼魔方 西西 提交于 2019-11-27 01:42:00
Is there a way how I can configure the Apache web server to return a 404 (not found) error code instead of 403 (forbidden) for some specific directories which I want to disallow to be accessed? I found some solutions suggesting the use of mod_rewrite, like e.g. RewriteEngine On RewriteRule ^.*$ /404 [L] As the purpose of sending 404 instead of 403 is to obfuscate the directory structure, this solution is too revealing, because it redirects to some different location which makes it obvious that the directory originally accessed does in fact exist. RedirectMatch as in e.g. RedirectMatch 404 ".*\