i create a generic handler class and ProcessRequest method execute on *.rar file.when user click a hyperlink for downloading a rar file how can i get navigateurl of hyperlink in ProcessRequest method
public class DownloadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
//get hyperlink navigateurl data
}
public bool IsReusable
{
get
{
return false;
}
}
}
if find the solution this way. when in generic class i redirect user to file download tooltip appear but browser want to open fil content(*.rar) and it cause problem for me
////////////////////////give hyperlink adress of generic handler class////////////////////////
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/DownloadHandler.ashx?MediaType="+Request.QueryString["MediaType"]+
"&ID="+DataBinder.Eval(Container.DataItem,"DownloadID")+"&url="+DataBinder.Eval(Container.DataItem,"DownloadURL") %>'
Text='<%# Eval("DownloadName") %>' Target="_blank"></asp:HyperLink>
/////////////////////in geberic handler class/////////////////////////////
public void ProcessRequest(HttpContext context)
{
Logical.Logic Logical = new Logical.Logic(); Logical.IncDownloadCount(HttpContext.Current.Request.QueryString["MediaType"],
HttpContext.Current.Request.QueryString["ID"]);
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.QueryString["url"]);// this line show downloaded file
}
Marked as answer by vahidarr on May 01, 2012 01:32 PM
vahidarr
Member
342 Points
474 Posts
get navigateurl of hyperlink in generic handler class
Mar 29, 2012 05:44 PM|LINK
i create a generic handler class and ProcessRequest method execute on *.rar file.when user click a hyperlink for downloading a rar file how can i get navigateurl of hyperlink in ProcessRequest method
public class DownloadHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { //get hyperlink navigateurl data } public bool IsReusable { get { return false; } } }Mauro_net
Contributor
2114 Points
402 Posts
Re: get navigateurl of hyperlink in generic handler class
Mar 30, 2012 05:37 AM|LINK
the key is the httpContext parameter you're getting:
context.Request.URL.ToString()
vahidarr
Member
342 Points
474 Posts
Re: get navigateurl of hyperlink in generic handler class
Mar 30, 2012 07:37 AM|LINK
if find the solution this way. when in generic class i redirect user to file download tooltip appear but browser want to open fil content(*.rar) and it cause problem for me
////////////////////////give hyperlink adress of generic handler class//////////////////////// <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/DownloadHandler.ashx?MediaType="+Request.QueryString["MediaType"]+ "&ID="+DataBinder.Eval(Container.DataItem,"DownloadID")+"&url="+DataBinder.Eval(Container.DataItem,"DownloadURL") %>' Text='<%# Eval("DownloadName") %>' Target="_blank"></asp:HyperLink> /////////////////////in geberic handler class///////////////////////////// public void ProcessRequest(HttpContext context) { Logical.Logic Logical = new Logical.Logic(); Logical.IncDownloadCount(HttpContext.Current.Request.QueryString["MediaType"], HttpContext.Current.Request.QueryString["ID"]); HttpContext.Current.Response.Redirect(HttpContext.Current.Request.QueryString["url"]);// this line show downloaded file }