Handler ASHX.file redirect to aspx page or Site RRS feed

  • Question

  • User-1008485531 posted

    Hi i want to know if there's another way to redirect  the ashx files to aspx page? .. because context.response.redirect is not working .. it only appears the  inner code of the  aspx page ...

    //THIS IS MY CODE .. when entering the try,  if there's no value it should go to catch after the catch i want to redirect the page to aspx ...

    but its not working  it just appear the code of the aspx not the whole page...

        if (int.Parse(decrecord) == 0)
                                    try {                                     SqlCommand dbCom4 = new SqlCommand("sp_Sample2", sqlcon154);
                                        dbCom4.CommandType = CommandType.StoredProcedure;
                                        dbCom4.Parameters.AddWithValue("@rec_ID", idid_);
                                        //Retrieve the data in Marketing_DB --> tblJob
                                        SqlDataAdapter da4 = new SqlDataAdapter();
                                        da4.SelectCommand = dbCom4;
                                        DataSet ds4 = new DataSet();
                                        da4.Fill(ds4, "dataset");
                                        DataTable _dt4 = new DataTable();
                                        _dt4 = ds4.Tables[0]; // This is the result of your query. 
                                        recrec = _dt4.Rows[0][0].ToString();
                                        _processDate = _dt4.Rows[0][13].ToString();
                                        senderName_ = _dt4.Rows[0][24].ToString();
                                        sender = _dt4.Rows[0][25].ToString();
                                        subject = _dt4.Rows[0][26].ToString();
                                        currentEdm = _dt4.Rows[0][28].ToString();
                                        ranky = decrecord;
    if theres no value it should go here and redirect to the page. but its not workin... theres another way to use redirect? thanks..
    catch (Exception) { context.Response.Redirect("default.aspx"); }

    Friday, February 17, 2012 10:50 PM


  • User1854529396 posted


    I have tried your code it is working fine. just use like this

    catch (Exception ex)
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 24, 2012 11:56 AM