response.redirect to classic asp failing

Posted by jeff on Stack Overflow See other posts from Stack Overflow or by jeff
Published on 2010-06-09T14:45:10Z Indexed on 2010/06/09 15:12 UTC
Read the original article Hit count: 260

Filed under:
|
|

I have the following code pasted below. For some reason, the response.redirect seems to be failing and it is maxing out the cpu on my server and just doesn't do anything. The .net code uploads the file fine, but does not redirect to the asp page to do the processing. I know this is absolute rubbish why would you have .net code redirecting to classic asp, it is a legacy app. I have tried putting false or true etc. at the end of the redirect as I have read other people have had issues with this. Please help as it's driving me insane! It's so strange, it runs locally on my machine but won't run on my server!

public void btnUploadTheFile_Click(object Source, EventArgs evArgs) 
    { 
        //need to check that the uploaded file is an xls file.

        string strFileNameOnServer = "PJI3.txt"; 
        string strBaseLocation = ConfigurationSettings.AppSettings["str_file_location"]; 
        if ("" == strFileNameOnServer) 
        {
            txtOutput.InnerHtml = "Error - a file name must be specified."; 
            return; 
        } 
        if (null != uplTheFile.PostedFile) 
        { 
            try 
            { 
                uplTheFile.PostedFile.SaveAs(strBaseLocation+strFileNameOnServer); 
                txtOutput.InnerHtml = "File <b>" + strBaseLocation+strFileNameOnServer+"</b> uploaded successfully"; 

                Response.Redirect ("/COBRA/pages/sap_import_pji3_prc.asp");

            } 
            catch (Exception e) 
            { 
                txtOutput.InnerHtml = "Error saving <b>" + strBaseLocation+strFileNameOnServer+"</b><br>"+ e.ToString(); 
            } 
        } 
    } 

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET