IIS webform can not upload file over 100kb - asp.net

I have a web and use IIS to setup
when I upload a pdf file which is over 100kb
there is two situations
1. On the IIS local PC
the action will success like this and the file is placed in the temp folder
enter image description here
2. On other PC
the action will fail and show nothing choose like this and the file is not placed in the temp folder
enter image description here
I have tried some solutions
set maxAllowedContentLength in web.config
set maxRequestEntityAllowed in web.config
enter link description here
set Maximum Request Entity Body Limit in IIS => ASP
Set Load User Profile = False
source : enter link description here
Plz someone help me to solve this problem
sorry for my bad English :(

The solution is changing IIS website port to 80 port

Use the following code.
<httpRuntime maxRequestLength="51200" executionTimeout="300"/>

Related

Telerik rad async file upload control is working well locally but not in server

I am using RadAsyncUpload control from Telerik to upload a file on the server. It is working well locally (on localhost) but not in the server. What did I miss?
(When I select a file to upload the dot becomes red instead of green)
I had the same behavior and it was a folder permissions issue.
Another symptom in this case, Chrome DevTools console was showing the following error when I attempt to upload a file:
HTTP Error code is 500
There is a temp folder where RadAsyncUpload saves files temporarily. If you don't define the TemporaryFolder property on the RadAsyncUpload control, the default will be in your App_Data\RadUploadTemp folder. If IIS_USERS don't have write permissions to this folder, the upload can't save a file here. It will work on your localhost because you have write permissions to that folder. Here's how to give the permissions necessary.
Right click on the App_Data\RadUploadTemp folder on server and
select proprties
Select Security tab
Click "Edit..." button
Under "Group or user names:", select IIS_USERS
Under "Permissions for IIS_USERS", check Write in the Allow
column.
Note: This was IIS 7 on Windows 2008 R2 Server.
The dot could become red either when the allowed file extension validation failed or when the file size exceeds the allowed one.
You can attach to the OnClientValidationFailed and OnClientFileUploadFailed events and check what the exact error is and fix it.
The Troubleshooting article offers additional information about the different errors and how to solve them.

strange issue when uploading file via asp.net, vs manually via FTP

I have a form in ASP.Net MVC, which allows you to upload a file. The file is saved to a location on the server. For example, if the domain is www.test-domain.com, and the local path is c:\websites\test-domain.com\, the image is stored in /uploads/File/image.jpg.
When I try to access this url http://www.test-domain.com/uploads/File/image.jpg, I get redirected to the forms loginUrl="XXXX" path in web.config. To test, I removed the web.config entirely, and accessed the file. This time round, I get a 401 - Unauthorized: Access is denied due to invalid credentials.
I then uploaded another file via FTP this time, to http://www.test-domain.com/uploads/File/image2.jpg. This one can be accessed without any problem. I even tried download image.jpg as saved via Asp.Net, delete the file on server and re-upload the same exact file by FTP and it worked again!
It seems by FTP is working, while via Asp.Net somehow there are some access / authorisation requirement. I do have authentication set in Asp.Net, but I removed the entire web.config file, and I still got an error.
Any ideas?
I've found out why this was happening, though it is totally unrelated to what I thought it was in the beginning. I am uploading an image and resizing it. I've looked further in the code, and for some reason I was creating an image in the temporary windows folder, and then moving it to the actual location using File.Move.
It seems that the security permissions created are different, than if I had to create the file directly in the final folder. I've updated the code to create the image directly in the actual folder, and this is working fine.
Reference: http://blogs.msdn.com/b/oldnewthing/archive/2006/08/24/717181.aspx

What is the best way to show an image (which is in local machine) in picturebox

I'm working on a project in ASP.NET but I'm stucked in this case;
I have ten thousands of images in local machine. I need to show them in the picturebox in ASP.Net. I can not copy all images to web appliation folder. So I have to give the file path like
\\server\something\something.jpg
But it doesnt work of course.
I found some solutions but they are not so clear, so I didnt manage to success.
So what should I do ?
In IIS, define a virtual sub-directory in your site, with directory's physical location being \\server\something. Then you will be able to specify image virtual url as ~/something.jpg.
Use code-behind to return images (aspx page or ashx handler) - then, with enough permissions given to IIS user, the web application will read the required image and put it in response stream.

"File or Directory not found" IIS 7

I have added an application on IIS 7 and the physical path selected correctly.
However, I got this problem when browsing the application:
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. the problem is also when I tried it like this: http://abc.com/default.aspx
but if I tried it with: http://abc.com/myimage.png => works
the server has installed .NET Framework 2.0, and also 4.0
Any idea what is wrong here?
THanks in advance.
Do you have the Default Document set to your homepage correctly?
One solution:
Try to add the type to IIS Mime types. Ex: I meet this error when try to click a mkv video file.
Open IIS Manager
Selection "MIME Type" feature
Add...
Enter this content
File name extension: mkv
Mime types: mkv/mkv
OK
Restart the website
Click the file again, its worked

How can a virtual directory path appear case sensitive?

Hopefully I can explain completely providing real info
To start with then we have a LinkButton whose text is actually an image tag.
The image it links to is a Png and resides in a folder in the web directory. This is IIS V6 and win Server 2003.
The path is http://webaddress/Admin/Images/image.png
Admin is a virtual directory configured in IIS.
The above url doesn't work but if you change it to http://webaddress/admin/Images/image.png (lowers case 'a') then the image is served, change it back to 'A' and it takes you to login, you log in and it loops back to log in. change to 'a' and voila the image is served. Weirdly this problem doesn't always occur and I have hunted for a resolution for days to no avail. Any ideas?
Thanks
As requested this is the complete link button
<asp:LinkButton ID="lnkCommitAll" runat="server" CausesValidation="false"><asp:Image ID="imgCommitAll" runat="server" ImageUrl="~/Images/Grid/confirm_16.png" AlternateText="Commit All Changes" /> Commit All</asp:LinkButton>
Could you post the whole LinkButton tag?
If Admin is a virtual directory then your image url should be like ~/Images/image.png
If so, do you have your virtual directory placed under the root with also a map called admin? In this case, try to rename it to "Admin", but don't forget to change the path in IIS for your virtual Directory.
I've had a similar problem before.
Hope this helps,
Arne

Resources