hi,
I am getting the error message "http error1:404:Not Found" while uploading the file.
I am able to trace the issue but it is very weird that it is reporting that the page "x.aspx" is not available.
Server Error in '/ApplicationName' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /ApplicationName/(S(sdkznz55wnwak5aomd5uqvy2))/ModuleName/Compose.aspx
In the above page, a user control is called in which the file upload logic is maintained.
I am using the CuteWebUI.AjaxUploader.dll version 3.0.
Kindly provide me the fix ASAP.
Regards,
Nazim
Here is the code that is implemented in the usercontrol that is called from Compose.aspx:
#region "Namespace"
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CuteWebUI;
#endregion
#region "Delegate"
public delegate void FileUploadEventHandler(object sender, FileUploadEventArgs e);
#endregion
public partial class UserControl_FileUpload : System.Web.UI.UserControl
{
#region "Delegate"
public event FileUploadEventHandler FileUploaded;
#endregion
PageBase pg = null;
PageBase.StoreObjectInSession eType = PageBase.StoreObjectInSession.LoggedUser;
private const string KEY = "FilesUploaded";
#region "Show or Hide Methods"
public void Show()
{
LoadLocalizedStrings();
Utility.SetPageCache();
Attachments1.ValidateOption.AllowedFileExtensions = ConfigurationManager.AppSettings["CuteWebUI.AjaxUploader.AllowedFileExtensions"];
if (ConfigurationManager.AppSettings["CuteWebUI.AjaxUploader.MaxFilesLimit"].Length > 0)
Attachments1.MaxFilesLimit = Convert.ToInt32(ConfigurationManager.AppSettings["CuteWebUI.AjaxUploader.MaxFilesLimit"]);
ShowOverlay();
}
#endregion
#region "Initialization Methods"
private void LoadLocalizedStrings()
{
ltFileAttachement.Text = Utility.GetPhraseFromResx(Utility.ResxFile.MC, Utility.ResxType.Others, "MC_FileAttachementCaption");
Attachments1.InsertText = Utility.GetPhraseFromResx(Utility.ResxFile.MC, Utility.ResxType.Others, "MC_BrowseCaption");
Attachments1.FileTooLargeMsg = Utility.GetPhraseFromResx(Utility.ResxFile.MC, Utility.ResxType.Errors, "MC_AttachmentExceedFileSizeLimit");
Attachments1.MaxFilesLimitMsg = Utility.GetPhraseFromResx(Utility.ResxFile.MC, Utility.ResxType.Errors, "MC_AttachmentExceededTotalFileLimit");
btnDone.Text = Utility.GetPhraseFromResx(Utility.ResxFile.MC, Utility.ResxType.Others, "MC_AttachmentDone");
btnCancel.Text = Utility.GetPhraseFromResx(Utility.ResxFile.MC, Utility.ResxType.Others, "MC_AttachmentCancel");
}
#endregion
#region "Event Handlers"
protected void Page_Load(object sender, EventArgs e)
{
pg = (PageBase)this.Page;
if (pg.SelectedUserID > 0)
eType = PageBase.StoreObjectInSession.LoggedUser;
if (!this.Page.ClientScript.IsStartupScriptRegistered(this.GetType(), "AlignOverlayCentered"))
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "AlignOverlayCentered", "fixOverlayWindowPosition();", true);
//if (!this.Page.ClientScript.IsStartupScriptRegistered(this.GetType(), "HideDropDownsForIE"))
//this.Page.ClientScript.RegisterStartupScript(this.GetType(), "HideDropDownsForIE", "hideDropDowns();", true);
}
protected void btnDone_Click(object sender, EventArgs e)
{
CloseOverlay();
NotifyAll();
}
protected void btnCancel_Click(object sender, EventArgs e)
{
CloseOverlay();
}
private void NotifyAll()
{
if (FileUploaded != null)
{
FileUploadEventArgs args = new FileUploadEventArgs();
args.UploadedFiles = GetHashtable();
FileUploaded(this, args);
}
}
protected void Attachments1_FileUploaded(object sender, UploaderEventArgs args)
{
Hashtable hFiles = null;
hFiles = GetHashtable();
try
{
hFiles.Add(args.FileGuid.ToString(), args.FileName);
}
catch (Exception)
{ }
pg.AddObjectToSession(KEY, hFiles, eType);
}
protected void lnkClose_Click(object sender, EventArgs e)
{
CloseOverlay();
}
#endregion
#region "Data Handler Methods"
private Hashtable GetHashtable()
{
return (Hashtable) pg.GetObjectFromSession(eType, KEY);
//ObjectToSession("FilesUploaded", hFiles, pg.SelectedUserID > 0 ? PageBase.StoreObjectInSession.SelectedUser : PageBase.StoreObjectInSession.LoggedUser);
//if (HttpContext.Current.Session["FilesUploaded"] != null)
// hFiles = (Hashtable)HttpContext.Current.Session["FilesUploaded"];
//else
// hFiles = new Hashtable();
//return hFiles;
}
#endregion
#region "Show or Hide Methods"
private void CloseOverlay()
{
this.Visible = false;
divFileUpload.Visible = false;
if (!this.Page.ClientScript.IsStartupScriptRegistered(this.GetType(), "ShowDropDownsForIE"))
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowDropDownsForIE", "showDropDowns();", true);
}
private void ShowOverlay()
{
this.divFileUpload.Visible = true;
this.Visible = true;
if (!this.Page.ClientScript.IsStartupScriptRegistered(this.GetType(), "HideDropDownsForIE"))
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "HideDropDownsForIE", "hideDropDowns();", true);
}
public void Clear()
{
Attachments1.DeleteAllAttachments();
//HttpContext.Current.Session["FilesUploaded"] = null;
pg.RemoveObjectFromSession(eType, KEY);
}
#endregion
}