File Upload Error in Classic ASP - file-upload

Set PersistsUpload = Server.CreateObject("Persits.Upload.1")
PersistsUpload.Save
set persistsfile = PersistsUpload.Files("file")
When I am uploading the file the following error is returned:
Request.BinaryRead failed: Unspecified error

In most cases it means that your upload script uses Request.Form or Request.QueryString prior to calling Upload.Save XXX. As a result, the BinaryRead method of the Request object fails.
see:
http://support.persits.com/show.asp?code=PS01032216

Related

How to catch errors thrown from "FilesInterceptor" decorator

I'm using the NestJS #FilesInterceptor to parse an array of files in a multipart request, here's how I use it:
#FilesInterceptor('files', 3, { some other options })
I need a specific error to be thrown if more than 3 files are sent, but what I get is a socket hangup client-side
Error: socket hang up
and this is the error logged in the console of the server:
Error: Unexpected end of multipart data
In the end: server crashed :(
So, how can I catch this error to handle it and prevent crashing?
It doesn't seem to be an instance of HttpException so the exception filter is not useful.
I could have done the length check in the controller, but I need { some other options }, so I must set a value for the maxCount
I found out the problem: the server has a global interceptor that implements a timeout for incoming requests. If I remove it, then the error is parsed correctly to an HttpException the client gets a BadRequest as expected
I'm still confused about why this doesn't work when I put it all together...

microsoft graph api - error responses returning as plain text

I'm using the the graph api in an internal .Net Core 3.1 webapi. However, each time a failed response is returned, it returns as a 500 internal error with the response as content-type: text/plain.
Status Code: NotFound
Microsoft.Graph.ServiceException: Code: Request_ResourceNotFound
Message: Resource '********' does not exist or one of its queried reference-property objects are not present.
Inner error:
AdditionalData:
date: 2020-10-13T13:44:21
request-id: 8053255b-2f1c-4543-8de7-*******
client-request-id: 8053255b-2f1c-4543-8de7-*******
ClientRequestId: 8053255b-2f1c-4543-8de7-*******
I am looking for the response to be return in JSON format similarly to the MS Graph Api explorer with the appropriate error code instead of a 500 Internal Error.
I believe the error you're looking for is inside
Microsoft.Graph.ServiceException -> Error -> Code.
If you'd like it in Json format you could convert it using JsonConverter.

AFNetworking JSON text did not start with array or object and option to allow fragments not set

I am getting response for my web-service like this when I run it in browser: IN.Tags.Share.handleCount({"count":5,"fCnt":"5","fCntPlusOne":"6","url":"http:\\myWebService?postid=24"});
But when I use afnetworking code to get response it gives error like:
Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set.
how can I get response like only :
({"count":5,"fCnt":"5","fCntPlusOne":"6","url":"http:\\myWebService?postid=24"})

400 Bad Request - Facebook Graph API - HttpWebRequest

Every time I run the following code I get an exception:
Code
Dim url As String = "https://graph.facebook.com/search?q=" & System.Web.HttpUtility.UrlEncode(_sourceData.Rows(i).Item(0).ToString) & "&type=event&limit=5000"
Dim getFullURL As String = (url & Convert.ToString("&access_token=")) + _appToken
Dim stream As New StreamReader(HttpWebRequest.Create(getFullURL).GetResponse().GetResponseStream())
Dim output As String = stream.ReadToEnd()
stream.Close()
Exception:
An unhandled exception of type 'System.Net.WebException' occurred in System.dll
Additional information: The remote server returned an error: (400) Bad Request.
My first thought was that it could be an execution limit Facebook has in place over each of their API access tokens; however, if I copy the contents of the 'getFullURL' string variable during runtime and paste it directly into my internet browser, it works fine. Given that it works to copy-paste into web browser, I'm very stuck on how to continue troubleshooting!
Any advice would be most appreciated.
This was related to me hitting the maximum API calls (200/hr). I had an erroneous loop that kept repeating the API call during my testing that made me hit this limit.

ServiceLocatorImplBase.cs not found on calling API help page

When I Uncomment this line for api documentation
//// Uncomment the following to use the documentation from XML documentation file.
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/BitCoinWrapperAPI.xml")));
I received an error :
An exception of type 'Microsoft.Practices.ServiceLocation.ActivationException' occurred in Microsoft.Practices.ServiceLocation.dll but was not handled in user code
Additional information: Activation error occured while trying to get instance of type HelpController, key ""
When I call the Index page in the HelpController of the API, anybody knows why?
Well I added this line and it works without exception
ObjectFactory.Configure(x => x.SelectConstructor(() => new HelpController()));