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. Display Image from Path

Display Image from Path

Scheduled Pinned Locked Moved C#
helptutorialquestion
11 Posts 4 Posters 0 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.
  • N Offline
    N Offline
    nudma
    wrote on last edited by
    #1

    Hi!!! I am trying to display image from C and D drive using following code. The code is very simple. Here it is:

    protected void Page_Load(object sender, EventArgs e)
    {
    Response.Write ("<table border='1'>");
    Response.Write ("<tr>");
    Response.Write ("<td><img src='D:\at.jpg'></td>");
    Response.Write ("<td><img src='C:\try.jpg'></td>") ;
    Response.Write ("</tr>" );
    Response.Write("</table>");
    }

    I neither get image on page nor error message. How could i resolve it?Please guide me...

    C B B 4 Replies Last reply
    0
    • N nudma

      Hi!!! I am trying to display image from C and D drive using following code. The code is very simple. Here it is:

      protected void Page_Load(object sender, EventArgs e)
      {
      Response.Write ("<table border='1'>");
      Response.Write ("<tr>");
      Response.Write ("<td><img src='D:\at.jpg'></td>");
      Response.Write ("<td><img src='C:\try.jpg'></td>") ;
      Response.Write ("</tr>" );
      Response.Write("</table>");
      }

      I neither get image on page nor error message. How could i resolve it?Please guide me...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Well, there's a few issues here. 1 - you are in the wrong forum. 2 - your asp.net site cannot see above it's root. 3 - I believe your \a and \t will be interpreted as special characters. Put an @ in front of the string to avoid this. @"Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • N nudma

        Hi!!! I am trying to display image from C and D drive using following code. The code is very simple. Here it is:

        protected void Page_Load(object sender, EventArgs e)
        {
        Response.Write ("<table border='1'>");
        Response.Write ("<tr>");
        Response.Write ("<td><img src='D:\at.jpg'></td>");
        Response.Write ("<td><img src='C:\try.jpg'></td>") ;
        Response.Write ("</tr>" );
        Response.Write("</table>");
        }

        I neither get image on page nor error message. How could i resolve it?Please guide me...

        B Offline
        B Offline
        Blikkies
        wrote on last edited by
        #3

        try this: protected void Page_Load(object sender, EventArgs e){ Response.Write (@"<table border='1'>"); Response.Write (@"<tr>"); Response.Write (@"<td><img src='D:\at.jpg'></td>"); Response.Write (@"<td><img src='C:\try.jpg'></td>") ; Response.Write (@"</tr>" ); Response.Write(@"</table>");}

        N 1 Reply Last reply
        0
        • N nudma

          Hi!!! I am trying to display image from C and D drive using following code. The code is very simple. Here it is:

          protected void Page_Load(object sender, EventArgs e)
          {
          Response.Write ("<table border='1'>");
          Response.Write ("<tr>");
          Response.Write ("<td><img src='D:\at.jpg'></td>");
          Response.Write ("<td><img src='C:\try.jpg'></td>") ;
          Response.Write ("</tr>" );
          Response.Write("</table>");
          }

          I neither get image on page nor error message. How could i resolve it?Please guide me...

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          You have to save image inside project folder,and insetad giving path to src property then just write name of image. Response.Write ("<td><img src='at.jpg'></td>"); Response.Write ("<td><img src='try.jpg'></td>") ;


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

          1 Reply Last reply
          0
          • N nudma

            Hi!!! I am trying to display image from C and D drive using following code. The code is very simple. Here it is:

            protected void Page_Load(object sender, EventArgs e)
            {
            Response.Write ("<table border='1'>");
            Response.Write ("<tr>");
            Response.Write ("<td><img src='D:\at.jpg'></td>");
            Response.Write ("<td><img src='C:\try.jpg'></td>") ;
            Response.Write ("</tr>" );
            Response.Write("</table>");
            }

            I neither get image on page nor error message. How could i resolve it?Please guide me...

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Also, for you to do this at all, is totally wrong. That's not what ASP.NET is for, it's better than that.

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            1 Reply Last reply
            0
            • B Blikkies

              try this: protected void Page_Load(object sender, EventArgs e){ Response.Write (@"<table border='1'>"); Response.Write (@"<tr>"); Response.Write (@"<td><img src='D:\at.jpg'></td>"); Response.Write (@"<td><img src='C:\try.jpg'></td>") ; Response.Write (@"</tr>" ); Response.Write(@"</table>");}

              N Offline
              N Offline
              nudma
              wrote on last edited by
              #6

              Thankyou Blikkies!! Thankyou so much...

              B B 2 Replies Last reply
              0
              • N nudma

                Thankyou Blikkies!! Thankyou so much...

                B Offline
                B Offline
                Blue_Boy
                wrote on last edited by
                #7

                Blikkies's code will not work,it will not display images. By the way you should post this question in ASP.NET forum.


                I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

                1 Reply Last reply
                0
                • N nudma

                  Thankyou Blikkies!! Thankyou so much...

                  B Offline
                  B Offline
                  Blikkies
                  wrote on last edited by
                  #8

                  But you have to take the images and paste it into your project, then the code should look like this:

                  protected void Page_Load(object sender, EventArgs e){
                  Response.Write (@"<table border='1'>");
                  Response.Write (@"<tr>");
                  Response.Write (@"<td><img src='at.jpg'></td>");
                  Response.Write (@"<td><img src='try.jpg'></td>") ;
                  Response.Write (@"</tr>" );
                  Response.Write(@"</table>");}

                  To able the client to see the images, the images should be in the Project folder.

                  N 1 Reply Last reply
                  0
                  • B Blikkies

                    But you have to take the images and paste it into your project, then the code should look like this:

                    protected void Page_Load(object sender, EventArgs e){
                    Response.Write (@"<table border='1'>");
                    Response.Write (@"<tr>");
                    Response.Write (@"<td><img src='at.jpg'></td>");
                    Response.Write (@"<td><img src='try.jpg'></td>") ;
                    Response.Write (@"</tr>" );
                    Response.Write(@"</table>");}

                    To able the client to see the images, the images should be in the Project folder.

                    N Offline
                    N Offline
                    nudma
                    wrote on last edited by
                    #9

                    One thing i want to ask... I assign image path to some string variable like this:

                    string path = "C:\at.jpg'

                    and apply this:

                    protected void Page_Load(object sender, EventArgs e)
                    {
                    Response.Write(@"<table border='1'>");
                    Response.Write(@"<tr>");
                    Response.Write(@"<td><img src=path></td>");
                    Response.Write(@"<td><img src='D:\try.jpg'></td>");
                    Response.Write(@"</tr>");
                    Response.Write(@"</table>");

                    Then it does not display image neither it shows any error message. Why so?Please help..

                    B B 2 Replies Last reply
                    0
                    • N nudma

                      One thing i want to ask... I assign image path to some string variable like this:

                      string path = "C:\at.jpg'

                      and apply this:

                      protected void Page_Load(object sender, EventArgs e)
                      {
                      Response.Write(@"<table border='1'>");
                      Response.Write(@"<tr>");
                      Response.Write(@"<td><img src=path></td>");
                      Response.Write(@"<td><img src='D:\try.jpg'></td>");
                      Response.Write(@"</tr>");
                      Response.Write(@"</table>");

                      Then it does not display image neither it shows any error message. Why so?Please help..

                      B Offline
                      B Offline
                      Blue_Boy
                      wrote on last edited by
                      #10

                      One thing you must know,you CAN'T load image which is located outside project's folder,because this is ASP.NET,buy the way your image control is HTML Image and still this doesn't provide you possibility to load images as you are trying. Why you don't create one folder inside your project and programmatically save images in that folder and then load it.


                      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

                      1 Reply Last reply
                      0
                      • N nudma

                        One thing i want to ask... I assign image path to some string variable like this:

                        string path = "C:\at.jpg'

                        and apply this:

                        protected void Page_Load(object sender, EventArgs e)
                        {
                        Response.Write(@"<table border='1'>");
                        Response.Write(@"<tr>");
                        Response.Write(@"<td><img src=path></td>");
                        Response.Write(@"<td><img src='D:\try.jpg'></td>");
                        Response.Write(@"</tr>");
                        Response.Write(@"</table>");

                        Then it does not display image neither it shows any error message. Why so?Please help..

                        B Offline
                        B Offline
                        Blikkies
                        wrote on last edited by
                        #11

                        Because your image should be in the project, you cant attatch images that out side the project. I take it that you did window form before moving to asp, in a window application you can specify source of image like "C:\aaa.jpg" but in html or asp its different ex. let say all your files including asp and C# files is in "c:\inetpub\wwwroot\Myproject", you have to insert your image aaa.jpg into "c:\inetpub\wwwroot\Myproject" then your code should look like this

                        <img src="../aaa.jpg" />

                        Hope this help you.

                        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