views:

50

answers:

2

I created a C# web project with MSVS 9 and thats all i know about my configurations.

In my browser i can access any aspx files i have in my project. However when i use http://localhost:3288/img/test.png i see nothing. The working directory is ./root, the png file is in ./root/img/test.png How do i have ASP.NET display my images and everything else in the folder? (and subfolders).

+1  A: 

Is the .png included in the solution?

When you hit the "play" button your essentially starting up a new website ( localhost:2383 ) so if its not in the solution it won't be copied over to the new, temporary, website that the debugger attaches too.

If this is the problem a quick fix is to hit the "Show all Files" button on the top of your solution explorer, this will show all the files in that folder on your hard drive. Then right click on the .png you want to include and hit "Include in Project".


Based on your comment your only solution is to actually create an IIS site for your solution with the root dir the same as your web project. Then in the project properties you'll have to tell the debugger to attach to your local IIS instead of visual studios. Not sure the exact click path, right click on your project and go to properties, look for debugging options.

jfar
Problem is i dynamically create images via user upload and right now via a separate exe. How do i add images that users upload when its dynamic?
acidzombie24
+1  A: 

Give a look to the ASP Image control , you can specify paths starting in your app root (~):

<asp:Image id="Image1" runat="server"
           ImageUrl="~/Images/image1.png"/>

Or you can use relative paths to the page that are displayed.

Check this article about ASP .NET Website Paths.

CMS