Last post Dec 22, 2009 06:14 AM by firstname.lastname@example.org
Dec 21, 2009 06:55 AMemail@example.com|LINK
i want to access the ashx method from my aspx page button click event. how to do this?
Dec 21, 2009 07:08 AM|shafaqat309|LINK
I have a related post
Dec 21, 2009 07:16 AMfirstname.lastname@example.org|LINK
shafaqat309 thanks for your post.
Your article related to AJAX but am asking ashx?
i want to access ashx method from my code behind, how to do this?
Dec 22, 2009 01:11 AMemail@example.com|LINK
anybody having idea regarding my doubt?
Dec 22, 2009 01:45 AM|manjul.dube|LINK
you can use Respons.Redirect as follows :
Response.Redirect("HandlerPage.ashx?ID="+ fileID.ToString()); within handler you have to use Httpcontex to post response ...
Dec 22, 2009 01:54 AMfirstname.lastname@example.org|LINK
Manu thanks for your response.
What ever ur telling is correct....
how i expect is when i clcik the aspx button then it'll download the file using ashx, but if i specify Response.Redirect then i lose my page am i right?
how to do this?
Dec 22, 2009 02:58 AM|manjul.dube|LINK
You are right via doing this way you will loose your page1 .. I can suggest you one approach just little change in design ...use a hypelink in page1 and navigate to page2 on page load of page 2 redirect to handler to download file .. via going this way
you will not loose your page1...
Dec 22, 2009 06:14 AMemail@example.com|LINK
manjul.dube thanks for your response.
i found different solution..
within button clicn event i wrote the js like this
String sCode = "window.open('../Folder/Handler.ashx?FileName=12225.pdf&FilePath=D:\\1323975.pdf&FileLength=500&Extension=pdf', '_blank');";
so that i can read the data as querystring on the ashx file.