Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. .net applications in .jpg files?

.net applications in .jpg files?

Scheduled Pinned Locked Moved C#
csharpwindows-admintutorialquestion
11 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Kir Birger

    i am trying to get a few dynamic image forms/pages/whatever you want to call them on my site, i made a form that simply writes the binary stream for an image object into the response stream and this works, but i need to get this to function while the file is .jpg and not .aspx does anyone know how to make IIS handle .jpgs as .net apps?

    G Offline
    G Offline
    Guffa
    wrote on last edited by
    #2

    In IIS manager, open the properties for the site, go to the Home Directory tab and click Configuration. Look att the entry for .aspx files, and add one with the same settings for .jpg files. --- b { font-weight: normal; }

    K 1 Reply Last reply
    0
    • G Guffa

      In IIS manager, open the properties for the site, go to the Home Directory tab and click Configuration. Look att the entry for .aspx files, and add one with the same settings for .jpg files. --- b { font-weight: normal; }

      K Offline
      K Offline
      Kir Birger
      wrote on last edited by
      #3

      i tried this and it doesn't seem to be working. i think it has something to do with content-type. in the code-behind i have to specify the content type to be image/jpg (or image/png) so that browsers like mozilla recognize it, is there a way to specify content type in the page directive?

      G D 2 Replies Last reply
      0
      • K Kir Birger

        i tried this and it doesn't seem to be working. i think it has something to do with content-type. in the code-behind i have to specify the content type to be image/jpg (or image/png) so that browsers like mozilla recognize it, is there a way to specify content type in the page directive?

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #4

        Standard question #1: What do you mean by "not working"? --- b { font-weight: normal; }

        K 1 Reply Last reply
        0
        • G Guffa

          Standard question #1: What do you mean by "not working"? --- b { font-weight: normal; }

          K Offline
          K Offline
          Kir Birger
          wrote on last edited by
          #5

          Firefox: The image “http://localhost/DynamicImage/image.png” cannot be displayed, because it contains errors. Iexplore: <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="DynamicImage.WebForm1" %> http://kbirger.no-ip.org/kir/image.png http://kbirger.no-ip.org/kir/WebForm1.aspx ^ that's the working version

          G 1 Reply Last reply
          0
          • K Kir Birger

            i tried this and it doesn't seem to be working. i think it has something to do with content-type. in the code-behind i have to specify the content type to be image/jpg (or image/png) so that browsers like mozilla recognize it, is there a way to specify content type in the page directive?

            D Offline
            D Offline
            DavidNohejl
            wrote on last edited by
            #6

            <@page ... ContentType="image/png" ... > :) @ Page syntax[^] Never forget: "Stay kul and happy" (I.A.)
            David's thoughts / dnhsoftware.org / MyHTMLTidy

            K 1 Reply Last reply
            0
            • K Kir Birger

              Firefox: The image “http://localhost/DynamicImage/image.png” cannot be displayed, because it contains errors. Iexplore: <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="DynamicImage.WebForm1" %> http://kbirger.no-ip.org/kir/image.png http://kbirger.no-ip.org/kir/WebForm1.aspx ^ that's the working version

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #7

              That is because the asp.net code is not executed at all. What is sent to the browser is only the contents of the file, unaltered. Have you registered then .png file type to be handled by asp.net? --- b { font-weight: normal; }

              K 1 Reply Last reply
              0
              • G Guffa

                That is because the asp.net code is not executed at all. What is sent to the browser is only the contents of the file, unaltered. Have you registered then .png file type to be handled by asp.net? --- b { font-weight: normal; }

                K Offline
                K Offline
                Kir Birger
                wrote on last edited by
                #8

                i registered both .jpg and .png the same as .aspx in the method mentioned above, but it still does not respond. the page itself returns an image and only an image (if you look at the source / hex) so i don't see what the problem is

                G 1 Reply Last reply
                0
                • D DavidNohejl

                  <@page ... ContentType="image/png" ... > :) @ Page syntax[^] Never forget: "Stay kul and happy" (I.A.)
                  David's thoughts / dnhsoftware.org / MyHTMLTidy

                  K Offline
                  K Offline
                  Kir Birger
                  wrote on last edited by
                  #9

                  that didn't seem to do anything. (i tried changing it between image/png and text/html)

                  1 Reply Last reply
                  0
                  • K Kir Birger

                    i registered both .jpg and .png the same as .aspx in the method mentioned above, but it still does not respond. the page itself returns an image and only an image (if you look at the source / hex) so i don't see what the problem is

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #10

                    The problem is that the code for the page is not executed at all, as the server does not recognise the files as being asp.net files. Check the settings again. --- b { font-weight: normal; }

                    K 1 Reply Last reply
                    0
                    • G Guffa

                      The problem is that the code for the page is not executed at all, as the server does not recognise the files as being asp.net files. Check the settings again. --- b { font-weight: normal; }

                      K Offline
                      K Offline
                      Kir Birger
                      wrote on last edited by
                      #11

                      At the moment I have to reinstall something on each computer, so I'll be configuring it from the start. All i have to do is go into the script configuration and change my image files to have the same settings as aspx files? i don't have to change the mime types?

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups