FineUploader Status 406 ASP.NET - asp.net-mvc

I'm using fineuploader in a ASP.NET Web Application in order to upload files. The uploads are working in most cases. The problem is that the upload of a few files is not working, I'm getting status code 406 when the client sends the post request with the file's chunck.
I tried sending files with the same name,similar size and extension as the files that are not working and they worked so it doesnt seem to be an issue with the filename,size or extension.I couldn't find something in common between these files.
I configured the chunck size for 5MB but also tried chaging to 2 MB and 10MB but they also didn't work.
Here is print of the request, can someone identify the problem and how to solve it?
From the requests, it seems to be some problem with the cloudfront or IIS? I don't know much about this.
Edit:
Looking at the IIS logs I found this, it seems the user is '-' for the request that returned 406, is the cs-username '-' because of the 406 or is the request 406 because of the cs-username '-'? If it's the second, what could make the user be lost like this?

The error message 406 means either the mime type in your Accept request header is invalid for IIS or IIS server can't return data via the type in Accept header.
So please check whether IIS->World wide web services->Static Content has been installed. Please ensure the type in Accept header is also valid in IIS manager->site node->Mime Types.
Now that your client only accept application/json, please ensure your your code will return the correct reponse type.
If that's not working, please enable failed request tracing and post detail error messages in the FRT log.
https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshoot-with-failed-request-tracing

Related

How to Fix HTTP Request Smuggling on IIS

In my ASP.NET MVC application, I want to resolve the HTTP Request Smuggling Vulnerability issue.
I thought it would be sufficient if I blocked the requests which have a Transfer-Encoding: chunked header. In the IIS administration menu, I added a new Request Filtering rule for this. However that does not seem to fix it.
I wrote little .NET code to test if IIS generates a 404 error when chunked content is sent. When I add the transfer encoding header 1 time to my test client code as below, I do NOT receive 404—I receive 200.
httpRequest.Headers.Add("Transfer-Encoding", "chunked");
Interestingly, if I add the header 2 times (I mean duplicate it) like
httpRequest.Headers.Add("Transfer-Encoding", "chunked");
httpRequest.Headers.Add("Transfer-Encoding", "chunked");
The filtering rule applies, and I receive 404 as I expected.
How can I fix it?
A few months later, Microsoft added a patch wherein you can disable request smuggling with a registry key.
Click Start, click Run, type Regedit in the Open box, and then click OK.
Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters
Set DWORD type value DisableRequestSmuggling to one of the following:
Set to 0 to disable the filter
Set to 1 to enable the filter
Exit Registry Editor.
Restart the computer.

Server Error 404 is returned when trying to get an authorization code from live.com

We have two applications which use OAuth2 authentication to get access to Hotmail.
The first application works fine. But in the second application we have an error after entering login/password:
Server Error
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
URLs and code used to show these URLs are identical in both application:
url = "https://login.live.com/oauth20_authorize.srf?response_type=code&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&scope=wl.imap+wl.offline_access+wl.emails&client_id=REAL-CLIENT-ID"
self.browser.load(QUrl(url))
Unfortunately, I have no idea how can fix it. Can anyone help me with this?
It's weird but this issue was fixed by adding:
QCoreApplication.setOrganizationName("anOrganizationName")
QCoreApplication.setOrganizationDomain("anOrganizationDomain")
QCoreApplication.setApplicationName("anApplicationName")
Perhaps it would be enough one of these string to fix issue. I didn't check it.

How to allow user to enter email in QueryString in MVC4?

User will type www.abc.com/Email/abc#abc.com
above code not work, It generates the error,
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Most likely causes:
The directory or file specified does not exist on the Web server.
The URL contains a typographical error.
A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
Create the content on the Web server.
Review the browser URL.
Check the failed request tracing log and see which module is calling SetStatus. For more information, click here.
Please read more here http://perishablepress.com/stop-using-unsafe-characters-in-urls/http://perishablepress.com/stop-using-unsafe-characters-in-urls/.
You should encode # to '%40' and decode it back to # in your MVC action.
To decode you can use encodeURIComponent
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_encodeuricomponent
you can use UrlDecode on backed http://msdn.microsoft.com/en-us/library/6196h3wt.aspx

Edit Web Part - HTTP 403 Forbidden Error

I have a webpart in a SharePoint 2007 site. This web part is written in object Model code. I am given Full Control to this Site Collection and can access the page with no issue.
When I tried to Edit it by clicking 'Site Actions--> Edit Page', I got the following error
Error:
The website declined to show this webpage- HTTP 403
Most likely causes:
•This website requires you to log in.
What you can try:
Go back to the previous page.
**More information**
This error (HTTP 403 Forbidden) means that Internet Explorer was able to connect to the website, but it does not have permission to view the webpage.
For more information about HTTP errors, see Help.
is that a user control or something like that which is accessing the File System path ?
if yes then you have to use SPSecurity.RunWithElevatedPrivilages(delegate() {}).
Have a look at this
Thanks
I resolved the HTTP 403 Forbidden issue. The root cause of the issue is, in my code has access to the file system on the server,to which the logged in users do not have the access while Editing the web part.
I have used RunWithElevatedPrivileges but only for getting the site info and updating the list. The code reading the config file and logging into the log file does not covered under ElevatedPrivileges.
I included them with Elevated Privileges, the users are able to Edit the web pat. We can also resolve this issue by giving ther read, write permissions to that particular files to 'SERVER\USERS'

When i used SMS plugin in grails i am getting error

i have service to send sms to the mobile through Application. I am getting the follwing error.
2011-06-06 19:37:35,729 [http-8080-2] ERROR sipgate.SipgateService - Server returned HTTP response code: 401 for URL: https://samurai.sipgate.net/RPC2
This probably means you are using an invalid username or password
Have you set up the config as explained on the plugin page (at the top of the documentation)?
I also assume that this means your earlier problem was solved... Can you accept the answer if my answer helped, or explain what you did to fix it if it did not?
I agree with Tim. You can only log in, if your Sipgate-Registration was verified by Sipgate.
Points, which you can check to see if your account is not working:
Try to log in on the sipgate.de webpage
Use the Perl-Client given here: http://www.sipgate.de/basic/api
The client can be downloaded at this location:http://www.sipgate.de/beta/public/static/downloads/basic/api/sipgate_api_perl_examples.zip
Hopefully you should not be able to do at least one of these things. Then you know you have to talk to the support # sipgate
The documentation on the plugin-page says, you have to have a 'conf/Config.groovy'-file. This means that you should have the basic Config.groovy file in the folder 'grails-app/conf/', which ships with every Grails installation. So my guess is that you might have created a different Config.groovy-file. So better check on the Config.groovy-file. The SMS-plugin should have generated some placeholders for you, where you need to enter your sipgate-account-data.

Resources