Click here to Skip to main content
15,887,027 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: A page can have only one server-side Form tag. Pin
Sendilkumar.M24-Aug-09 19:31
Sendilkumar.M24-Aug-09 19:31 
QuestionHow to create exe file of C# web project? Pin
nudma24-Aug-09 18:15
nudma24-Aug-09 18:15 
AnswerRe: How to create exe file of C# web project? Pin
Abhijit Jana24-Aug-09 18:28
professionalAbhijit Jana24-Aug-09 18:28 
AnswerRe: How to create exe file of C# web project? Pin
ali_reza_zareian24-Aug-09 18:41
ali_reza_zareian24-Aug-09 18:41 
GeneralRe: How to create exe file of C# web project? Pin
nudma25-Aug-09 4:38
nudma25-Aug-09 4:38 
AnswerRe: How to create exe file of C# web project? Pin
Christian Graus24-Aug-09 19:03
protectorChristian Graus24-Aug-09 19:03 
GeneralRe: How to create exe file of C# web project? Pin
nudma25-Aug-09 4:34
nudma25-Aug-09 4:34 
QuestionHttpHandler to display image [modified] Pin
Chazzysb24-Aug-09 9:16
Chazzysb24-Aug-09 9:16 
Hi im using VS2008 to upload and display images.

I have a control with an <asp:Image control in it... if i save the image to a file on the server and specify the ImageUrl of the control it works fine.
however i want to avoid writing the image to a file before displaying it.

first of all, can I use the &lt;asp:Image control to display the output of a httphandler or do i need to use something like
<img alt=""httpHandler"" src=""../App_Code/ImageHandler.ashx?productid={0}"">

secondly, what if anything do i need to add to the web config? - under HttpHandlers if I add
<add verb="*" path="*" type="ImageHandler"/>
then the actual pages are not loaded - just the results of the http handler as soon as the page loads
(I guess this tells me the actual HttpHandler works as the image is displayed)

the control that wants to use the HttpHandler is in a 'Controls' directory, the HttpHandler is in the 'App_Code' directory

the ImageHandler.ashx file is:
<%@ WebHandler Language="C#" Class="ImageHandler" CodeBehind="ImageHandler.cs" %>

the ImageHandler.cs file is:
using System;
using System.Web;
using DataLinq;
using BLL = BusinesLogic;

public class ImageHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
int _productID;
if (context.Request.QueryString["productid"] != null)
{
_productID = Convert.ToInt32(context.Request.QueryString["productid"]);
}
else
{
throw new ArgumentException("No parameter specified");
}

Product product = BLL.ProductBLL.GetByID(_productID);

if (product != null)
{
context.Response.ContentType = "image/jpeg";
context.Response.BinaryWrite(product.Image.ToArray());
}
}

public bool IsReusable
{
get
{
return false;
}
}
}

Thanks,
Chas

modified on Monday, August 24, 2009 3:22 PM

AnswerRe: HttpHandler to display image Pin
Chazzysb24-Aug-09 9:54
Chazzysb24-Aug-09 9:54 
GeneralRe: HttpHandler to display image Pin
Christian Graus24-Aug-09 10:13
protectorChristian Graus24-Aug-09 10:13 
QuestionEnumerate Monitors On Client Machine Using JavaScript And ASP.NET Pin
Polymorpher24-Aug-09 3:13
Polymorpher24-Aug-09 3:13 
AnswerRe: Enumerate Monitors On Client Machine Using JavaScript And ASP.NET Pin
Parwej Ahamad24-Aug-09 4:47
professionalParwej Ahamad24-Aug-09 4:47 
AnswerRe: Enumerate Monitors On Client Machine Using JavaScript And ASP.NET Pin
Christian Graus24-Aug-09 9:49
protectorChristian Graus24-Aug-09 9:49 
GeneralRe: Enumerate Monitors On Client Machine Using JavaScript And ASP.NET Pin
Polymorpher24-Aug-09 13:37
Polymorpher24-Aug-09 13:37 
Questionfixing the page width [modified] Pin
hasani200724-Aug-09 1:38
hasani200724-Aug-09 1:38 
AnswerRe: fixing the page width Pin
Parwej Ahamad24-Aug-09 4:36
professionalParwej Ahamad24-Aug-09 4:36 
Questiongridscroll Pin
Member 429504224-Aug-09 1:34
Member 429504224-Aug-09 1:34 
AnswerRe: gridscroll Pin
Abhijit Jana24-Aug-09 18:04
professionalAbhijit Jana24-Aug-09 18:04 
AnswerRe: gridscroll Pin
Member 429504224-Aug-09 20:55
Member 429504224-Aug-09 20:55 
QuestionImplimentation of BindingManagerBase class Pin
rj shukla24-Aug-09 1:23
rj shukla24-Aug-09 1:23 
AnswerRe: Implimentation of BindingManagerBase class Pin
N a v a n e e t h24-Aug-09 5:22
N a v a n e e t h24-Aug-09 5:22 
QuestionUse of save in FCK editor Pin
suzzain24-Aug-09 0:57
suzzain24-Aug-09 0:57 
AnswerRe: Use of save in FCK editor Pin
N a v a n e e t h24-Aug-09 1:14
N a v a n e e t h24-Aug-09 1:14 
Question[Message Deleted] Pin
rj shukla24-Aug-09 0:35
rj shukla24-Aug-09 0:35 
AnswerRe: BindingBaseManager class in Asp.Net Pin
N a v a n e e t h24-Aug-09 1:12
N a v a n e e t h24-Aug-09 1:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.