I am getting different behavior when using the async upload in SSL. In SSL, It errors and gives a 413 error for any file that is over 1 MB. When I try it on a non ssl area, the file uploads fine. Are there different settings under SSL that's preventing me from uploading larger files? If so how do I change them?
Here's the code I'm using.
Codebehind:
Here's the code I'm using.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
script
type
=
"text/javascript"
src
=
"js/jquery-1.8.3.js"
></
script
>
<
script
type
=
"text/javascript"
>
// $(document).ready(function() {
// if (!$telerik.$ == true)
// $telerik.$ = jQuery;
// });
function OnClientValidationFailed(sender, args) {
var fileExtention = args.get_fileName().substring(args.get_fileName().lastIndexOf('.') + 1, args.get_fileName().length);
if (args.get_fileName().lastIndexOf('.') != -1) {//this checks if the extension is correct
// if (sender.get_allowedFileExtensions().indexOf(fileExtention)) {
// alert(args.get_message());
// alert("Wrong Extension!");
// }
// else {
// alert("Wrong file size!");
// }
alert("File is over the limit or extension is not allowed.");
}
else {
alert("not correct extension!");
}
}
// var $ = $telerik.$;
function OnClientFileUploadFailed(sender, args) {
if (args.get_message() == "error") {
args.set_handled(true);
}
}
function submitPage() {
//finds all file uploads that are currently in progress
var isUploadComplete = true;
var uploadingRows = $(".RadAsyncUpload").find(".ruUploadProgress");
//iterates and checks is there any file uploads that are successfully completed or failed and if yes - pop-up an alert box and prevent page submitting
for (var i = 0; i <
uploadingRows.length
; i++) {
if (!$(uploadingRows[i]).hasClass("ruUploadCancelled") && !$(uploadingRows[i]).hasClass("ruUploadFailure") && !$(uploadingRows[i]).hasClass("ruUploadSuccess")) {
alert("you could not submit the page during upload :)");
isUploadComplete
=
false
;
break;
}
}
return isUploadComplete;
}
</script>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<%-- <
telerik:RadScriptBlock
runat
=
"server"
ID
=
"RadScriptBlock1"
>
<
script
type
=
"text/javascript"
>
Telerik.Web.UI.RadAsyncUpload.Modules.Silverlight.isAvailable = function() { return false; };
Telerik.Web.UI.RadAsyncUpload.Modules.Flash.isAvailable = function() { return false; };
</
script
>
</
telerik:RadScriptBlock
>--%>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadAsyncUpload
ID
=
"ruReady"
runat
=
"server"
TemporaryFolder
=
"TempUpload"
MaxFileInputsCount
=
"5"
TemporaryFileExpiration
=
"02:00:00"
MaxFileSize
=
"105906176"
PostbackTriggers
=
"LinkButton2"
OnClientValidationFailed
=
"OnClientValidationFailed"
OnClientFileUploadFailed
=
"OnClientFileUploadFailed"
MultipleFileSelection
=
"Automatic"
></
telerik:RadAsyncUpload
>
<
asp:LinkButton
ID
=
"LinkButton1"
runat
=
"server"
>Test</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"LinkButton2"
runat
=
"server"
OnClientClick
=
"return submitPage();"
>Test2</
asp:LinkButton
>
</
div
>
<
br
/>
<
asp:Literal
ID
=
"litPath"
runat
=
"server"
></
asp:Literal
>
</
form
>
</
body
>
</
html
>
Codebehind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strUploadPath = Server.MapPath("~/TestUpload/")
litPath.Text = strUploadPath
End Sub
Protected Sub FileUploaded() Handles ruReady.FileUploaded
'nothing here at the moment
End Sub
Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButton2.Click
If Page.IsPostBack Then
UploadFile(ruReady, 1)
End If
End Sub
Private Sub UploadFile(ByVal AsyncUpload As Telerik.Web.UI.RadAsyncUpload, ByVal iID As Long)
'Dim strUploadPath = "E:\AsyncUploadApp\WebApplication1\WebApplication1\TestUpload\"
Dim strUploadPath = Server.MapPath("~/TestUpload/")
If AsyncUpload.UploadedFiles.Count > 0 Then
For Each file As Telerik.Web.UI.UploadedFile In AsyncUpload.UploadedFiles
Dim strGUID As String
strGUID = Guid.NewGuid.ToString
Dim count As Integer = 0
Dim strOriginalFileName As String = file.GetNameWithoutExtension.Replace(" ", "_") '.Replace("'", "").Replace("&", "and")
Dim strFileGUIDName As String = strGUID & "_" & strOriginalFileName & file.GetExtension
'Dim strFileFullPath As String = Path.Combine(strUploadPath, strFileGUIDName)
Dim strFileFullPath As String = strUploadPath & strFileGUIDName
'Using Hosting.HostingEnvironment.Impersonate
count += 1
file.SaveAs(strFileFullPath, True)
'End Using
Next
End If
'ruReady.Dispose()
End Sub