Results 1 to 4 of 4

Thread: Having an asp.net page showing an image instead of html

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

    Having an asp.net page showing an image instead of html

    in nowdays we see a lot of this..for example i have myAsp.aspx and when i open it instead of html i get an image...this is due that contentType propriety has "image/jpeg"..but..what do i have to do in asp.net so i can make the same effect? i tryed this : (it's in C# but u should have no troubles understanding it):

    PHP Code:
        public class WebForm1 System.Web.UI.Page
        
    {
            private 
    void Page_Load(object senderSystem.EventArgs e)
            {
                
    Bitmap image = new Bitmap(100100PixelFormat.DontCare);
                
    Graphics g Graphics.FromImage(image);
                
    g.DrawRectangle(new Pen(new SolidBrush(Color.Red)), 005050);
                
    ImageCodecInfo[] imgCodecs ImageCodecInfo.GetImageEncoders();
                
    EncoderParameters imgParams = new EncoderParameters(1);
                
    image.Save(Response.OutputStreamimgCodecs[1], imgParams);
                
    // Put user code to initialize the page here
            

    if anyone has another example in C# or VB.NET could give it to me plz?
    \m/\m/

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I haven't got a clue as to what your talking about, maybe you can explain it a little more so I can help you out. Maybe include some examples of pages your talking about or something.

  3. #3

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    i want to do this:

    look! it is not an JPG image..it's an aspx file..but that has an contentType set to "image/jpeg"...the image is being dinamicaly created by a asp.net page..how do i do this in asp.net? any examples?

    tks
    \m/\m/

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    here you go guys. put at the top of your page

    <%@ Page Language="VB" ContentType="image/jpeg" %>
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width