Handler ASHX.file redirect to aspx page or Sitehttp://forums.asp.net/t/1770940.aspx/1?Handler+ASHX+file+redirect+to+aspx+page+or+SiteFri, 24 Feb 2012 15:56:34 -050017709404838386http://forums.asp.net/p/1770940/4838386.aspx/1?Handler+ASHX+file+redirect+to+aspx+page+or+SiteHandler ASHX.file redirect to aspx page or Site <p>Hi i want to know if there's another way to redirect&nbsp; the ashx files to aspx page? .. because context.response.redirect is not working .. it only appears the&nbsp; inner code of the&nbsp; aspx page ...</p> <p></p> <p>//<strong>THIS IS MY CODE .. when entering the try,&nbsp; if there's no value it should go to catch after the catch i want to redirect the page to aspx ...</strong></p> <p>but its not working&nbsp; it just appear the code of the aspx not the whole page...</p> <pre class="prettyprint">if (int.Parse(decrecord) == 0) { <strong>try { </strong> SqlCommand dbCom4 = new SqlCommand(&quot;sp_Sample2&quot;, sqlcon154); dbCom4.CommandType = CommandType.StoredProcedure; dbCom4.Parameters.AddWithValue(&quot;@rec_ID&quot;, idid_); sqlcon154.Open(); //Retrieve the data in 192.168.9.154 Marketing_DB --&gt; tblJob SqlDataAdapter da4 = new SqlDataAdapter(); da4.SelectCommand = dbCom4; DataSet ds4 = new DataSet(); da4.Fill(ds4, &quot;dataset&quot;); DataTable _dt4 = new DataTable(); _dt4 = ds4.Tables[0]; // This is the result of your query. sqlcon154.Close(); 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; <strong> }</strong> 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(&quot;default.aspx&quot;); }</pre> 2012-02-18T02:50:56-05:004849689http://forums.asp.net/p/1770940/4849689.aspx/1?Re+Handler+ASHX+file+redirect+to+aspx+page+or+SiteRe: Handler ASHX.file redirect to aspx page or Site <p>Hi,</p> <p></p> <p>I have tried your code it is working fine. just use like this</p> <pre class="prettyprint">catch (Exception ex) { context.Response.Redirect(&quot;~/default.aspx&quot;); }</pre> 2012-02-24T15:56:34-05:00