Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:47:29+00:00 2026-05-30T03:47:29+00:00

I am currently trying to create a custom server control in asp.net c# and

  • 0

I am currently trying to create a custom server control in asp.net c# and am using VS2010.

I am trying to create a custom server control that can load images straight into a separate web project. E.g. Custom Server Control and a separate web project where I can drag and drop my control onto it with minimal installation and config. The point being it can be re used anywhere on other web projects.

I have created a basic custom control, but I need to be able to load images directly through the custom server control and display them in my separate web project. The images will be coming from a static location for the time being.

So basically I have an image, I want to load and pass that image into the control and then display it on a webpage where the custom control is placed. I have investigated image handlers, and having separate generic handlers but am not having any luck.

Image location –> Custom Control –> Web page displaying image that has been passed into custom control.

Anyone have any idea how to do this, or go about this?

UPDATE:

I am sorry I was not clear enough first time round.

I have two projects, one custom control project, and one asp.net website project. The first project (Custom Control) takes a byte stream from a webservice and converts it to an Image object. At this point I want the control to add that image to a webpage in the website. The custom control is then registered with the asp.net website and the controls I have added are rendered to the page. However I want to render the image I have recovered from the buffer, then converted to a file locally onto the web page.

I have no problem getting the image from the bytestream, and storing the image in a directory. The issue I am having is that I want the image to be rendered on the webpage, without having the image stored in the web project at first. I have thought about storing the image in a web directory so when I run the project I can set an image url to localhost/images/myimagefrombystream.jpg but am unsure whether this is the correct approach.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:47:30+00:00Added an answer on May 30, 2026 at 3:47 am

    We have a server controls library that contains some images that are reused across a number of other web projects.

    The approach we took was to mark the each images build action as Embedded Resource. Then in the AssemblyInfo file we have lines like the following:

    [assembly: WebResource("AssemblyName.SubDirectory.ImageName.png", "image/png")]
    

    Where AssemblyName is the actual project name, the SubDirectory is the directory in the project the image(s) are located in, etc.

    This project also emits CSS files; which are also Embedded Resources. The CSS files refer to these images using:

    .someImage {
        height: 85px;
        background-image: url(<%=WebResource("AssemblyName.SubDirectory.Image.png") %>);
        background-repeat: repeat-x;
        margin: 0px;
        padding: 0px;
    }
    

    In the class code, we’ll refer to those css files like:

    HtmlLink cssLink = new HtmlLink();
    cssLink.Href = Page.ClientScript.GetWebResourceUrl(this.GetType(), "AssemblyName.css.SomeCssFile.css");
    cssLink.Attributes.Add("rel", "stylesheet");
    cssLink.Attributes.Add("type", "text/css");
    

    We could just as easily refer to the images directly using something like the above.

    At this point the assembly is 100% portable. All of the CSS files and required images are embedded into it so you don’t have to worry if the calling application has those same images at all.

    Incidentally, this is how a number of control vendors do things; at least the better ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to create a custom server control CollapsablePanel that extends ASP.net's Panel.
I'm currently trying to create a desktop like homepage where using can move around
I'm currently trying to create a custom navigation-bar for my navigation-controller in iOS using
I am currently trying to create a win32 service using pywin32. My main point
I'm currently trying to create a kernel module that will produce data based on
I'm currently trying to create a program that estimates location based on signal strength.
I am currently trying to create an Android application that loops Audio from the
Currently trying to create an XML system using Ogre and the STL. As a
I am currently trying to create a custom Deflate implementation in C#. I am
I'm currently trying to create a gallery of pictures loaded from Internet. I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.