Last post Apr 20, 2012 04:39 AM by harshil_sheth
Member
2 Points
23 Posts
Apr 19, 2012 07:11 AM|harshil_sheth|LINK
How to get image url from handler file. like
source code:
<asp:Image runat="server" ImageUrl="~/Handler.ashx" Width="100px" Height="100px" />
handler.ashx:
string r = "../comingsoon.jpg";
context.Response.ContentType = "text/plain"; context.Response.Write(r);
---------------------
but i cant able to see image
so please help mesolve my problem.
Thank you.
All-Star
27248 Points
6183 Posts
Apr 19, 2012 07:19 AM|kedarrkulkarni|LINK
make sure the path of handler file is correct...
place breakpoint in handler file.... it should be hit when running the page....
also, you should specify the path of image file as
string r = context.Server.MapPath("FolderNameWhereImage") + "/comingsoon.jpg";
hope this helps...
Apr 19, 2012 07:36 AM|harshil_sheth|LINK
but my image placed on remote server than what should i do?
Apr 19, 2012 07:46 AM|kedarrkulkarni|LINK
harshil_sheth but my image placed on remote server than what should i do?
what is mean by remote server? are you using file share path? or http path?
u had earlier used this path
which dosent indicate where the file is
Apr 19, 2012 07:53 AM|harshil_sheth|LINK
Remote path means
http://www.hollywoodreporter.com/sites/default/files/2011/05/googlelogoa_a_l.jpg
it is not in my project so how can i do it?
and i dont want to do it with httpwebrequest.
Apr 19, 2012 08:11 AM|kedarrkulkarni|LINK
harshil_sheth Remote path means http://www.hollywoodreporter.com/sites/default/files/2011/05/googlelogoa_a_l.jpg it is not in my project so how can i do it? and i dont want to do it with httpwebrequest.
why to use handler then... u can simply do
<asp:Image runat="server" ImageUrl="http://www.hollywoodreporter.com/sites/default/files/2011/05/googlelogoa_a_l.jpg" Width="100px" Height="100px" />
Apr 20, 2012 04:39 AM|harshil_sheth|LINK
It is solve by
<asp:Image runat="server" ImageUrl="http://localhost:13313/CTB/IdentifyImage.ashx?u=http://www.hollywoodreporter.com/sites/default/files/2011/05/googlelogoa_a_l.jpg" Width="100px" Height="100px" />
string url = context.Request["u"].ToString();
context.Response.ContentType = r; context.Response.Redirect(r);
Member
2 Points
23 Posts
get image url from Handler file
Apr 19, 2012 07:11 AM|harshil_sheth|LINK
How to get image url from handler file. like
source code:
<asp:Image runat="server" ImageUrl="~/Handler.ashx" Width="100px" Height="100px" />
handler.ashx:
string r = "../comingsoon.jpg";
context.Response.ContentType = "text/plain";
context.Response.Write(r);
---------------------
but i cant able to see image
so please help mesolve my problem.
Thank you.
All-Star
27248 Points
6183 Posts
Re: get image url from Handler file
Apr 19, 2012 07:19 AM|kedarrkulkarni|LINK
make sure the path of handler file is correct...
place breakpoint in handler file.... it should be hit when running the page....
also, you should specify the path of image file as
string r = context.Server.MapPath("FolderNameWhereImage") + "/comingsoon.jpg";
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
Member
2 Points
23 Posts
Re: get image url from Handler file
Apr 19, 2012 07:36 AM|harshil_sheth|LINK
but my image placed on remote server than what should i do?
All-Star
27248 Points
6183 Posts
Re: get image url from Handler file
Apr 19, 2012 07:46 AM|kedarrkulkarni|LINK
what is mean by remote server? are you using file share path? or http path?
u had earlier used this path
string r = "../comingsoon.jpg";
which dosent indicate where the file is
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
Member
2 Points
23 Posts
Re: get image url from Handler file
Apr 19, 2012 07:53 AM|harshil_sheth|LINK
Remote path means
http://www.hollywoodreporter.com/sites/default/files/2011/05/googlelogoa_a_l.jpg
it is not in my project so how can i do it?
and i dont want to do it with httpwebrequest.
All-Star
27248 Points
6183 Posts
Re: get image url from Handler file
Apr 19, 2012 08:11 AM|kedarrkulkarni|LINK
why to use handler then... u can simply do
<asp:Image runat="server" ImageUrl="http://www.hollywoodreporter.com/sites/default/files/2011/05/googlelogoa_a_l.jpg" Width="100px" Height="100px" />
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
Member
2 Points
23 Posts
Re: get image url from Handler file
Apr 20, 2012 04:39 AM|harshil_sheth|LINK
It is solve by
<asp:Image runat="server" ImageUrl="http://localhost:13313/CTB/IdentifyImage.ashx?u=http://www.hollywoodreporter.com/sites/default/files/2011/05/googlelogoa_a_l.jpg" Width="100px" Height="100px" />
string url = context.Request["u"].ToString();
context.Response.ContentType = r;
context.Response.Redirect(r);