locked
AjaxUpload Forms authentication issue RRS feed

  • Question

  • User948188685 posted

    Currently, I have a project that is using the HTML 4 upload control within an IFRAME (to get some sort of async processing when uploading a file to a database – before the advent of the AJAX upload control).

    A strange thing occurs when the user’s browser is set to Standards Mode for IE10-11. When the SRC tag of the IFRAME is programmatically changed on page load or post back any CSS (external CSS files) in the parent page containing “background-color” get removed from the page once the IFRAME loading is complete . As it only occurs with IE in standards mode (IE7,Chrome, Firefox no issues), I’ve chalked it up to browser bug that will like never get addressed.

    Anyway, I was trying to work with the AjaxUpload control (framework 3.5) so I could do away with the IFRAME. Is there any way to change the temp directory the control uses to process the file? By default it wants to use what Windows environment says (System.IO.Path.GetTempPath()). This will not work when an application uses forms authentication when the web.config has

    <deny users="?"/>

    I do not see any control properties that allow me to set the path to be relative to the application.  Ideally this should all be done in memory without the need for a temp file location, but that doesn’t appear to be the way the Ajax control is designed for this framework.

    Your input would be much appreciated. If anyway knows how to address the CSS breaking issue, I’m willing to work that route too.

    Monday, March 10, 2014 12:44 PM

Answers

  • User-417640953 posted

    I do not see any control properties that allow me to set the path to be relative to the application.  Ideally this should all be done in memory without the need for a temp file location, but that doesn’t appear to be the way the Ajax control is designed for this framework.

    Hi mrwww76,

    Thanks for your post.

    The AjaxFileUpload control buffers the file being uploaded onto your web server's hard drive. This temporary folder is located at Path.GetTempPath().        

    When you call the SaveAs() method to save the uploaded file to a new location, the AjaxFileUpload control deletes the temporary file automatically.

    In the server side we use a httphandler "AjaxFileUploadHandler.axd" to receive the file upload request, then copy file to project folder.

    That can complete the asynchronous feature. So we should not di it in server memory.

    For chaning the AjaxFileUpload temporary folder directory, you can try below static method of AjaxFileUpload.

    AjaxControlToolkit.AjaxFileUpload.BuildTempFolder(), for more information you can refer to below thread.

    http://stackoverflow.com/questions/17942765/ajaxfileupload-file-not-inheriting-folder-permissions

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 12, 2014 3:15 AM