pictures display in design mode but not browser visual studio

I have been trying to setup images in a vb.net application. I can see the images when in design mode but when I hit f5 to view in a browser the images do not show only the red X with the alt tag. I don't know what I am missing.

I'm using visual studio 2005 and my OS is Vista

Thanks for any help
LVL 5
OrionsXAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
What path do you use for the pictures ?
0
Tapan PattanaikSenior EngineerCommented:
hi OrionsX,
       
                Check it , i hope it will work.
<img runat="server" src="~/image/photo-small.jpg" class="photosmall" width="150"
                    height="100" alt="Write a short description of the image here. It will show if the imageis not loaded. Non visual browsers and search engines will also read this text."
                    title="Users will see this text when they roll over this image. Non-visual browsers will read this text to blind users." />

Open in new window

0
Tapan PattanaikSenior EngineerCommented:
<img runat="server" src="~/image/photo-small.jpg" class="photosmall" width="150"
                    height="100" alt="Write a short description of the image here. It will show if the imageis not loaded. Non visual browsers and search engines will also read this text."
                    title="Users will see this text when they roll over this image. Non-visual browsers will read this text to blind users." />


========================

"~/image/photo-small.jpg" = path, you choose your path accordingly.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

OrionsXAuthor Commented:
jp,

I use  <img alt="header" src="App_Data/header.jpg" style="z-index: 112; left: 0px; position: absolute;
            top: 0px" /> to call the pic.

tapan,

I tried to use <img alt="header" src="~/App_Data/header.jpg" style="z-index: 112; left: 0px; position: absolute;
            top: 0px" />
but the pic wouldn't display in design mode or the browser.

Am I missing something in IIS maybe?
0
Jorge PaulinoIT Pro/DeveloperCommented:
>> but the pic wouldn't display in design mode or the browser.
But it shows when you run it, right ?
0
OrionsXAuthor Commented:
...FYI...I originally tried to setup a master page but encountered this problem. I then decided to try to just place a pic on the page to see if I could at least do that but found that I couldn't.  I do eventually want to use a master page for the pics, but want to first find out why the pics aren't displaying...
0
OrionsXAuthor Commented:
jp,

No I get nothing when I use ~/ before the source path (<img alt="header" src="~/App_Data/header.jpg....)

When I use (<img alt="header" src="App_Data/header.jpg....), I see the pic in design mode but not when I run it...
0
Tapan PattanaikSenior EngineerCommented:
hi OrionsX,

               Use src="../App_Data/header.jpg"   and check this and post your comment.


I am waiting for your replay.





0
Tapan PattanaikSenior EngineerCommented:
hi OrionsX,

                 Try the below code and post your replay.

<img alt="header" runat="server" src="../App_Data/header.jpg" style="z-index: 112; left: 0px; position: absolute;top: 0px" />


thanks.
0
OrionsXAuthor Commented:
tapan,

still nothing... in neither design nor run mode

I'm starting to think it is an IIS setting or other config issue but I have not a clue
0
Tapan PattanaikSenior EngineerCommented:
can you post your code ?
0
OrionsXAuthor Commented:
My .Net code is below, Ill post the code behind in the next pane:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="login.aspx.vb" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server"
            Style="z-index: 100; left: 256px;
            position: absolute; top: 240px"
            Text="Email Address:"></asp:Label>
        <asp:Label ID="Label2" runat="server"
            Style="z-index: 101; left: 280px;
            position: absolute; top: 272px"
            Text="Password:"></asp:Label>
        <asp:TextBox ID="txtUserID" runat="server"
            Style="z-index: 102; left: 360px;
            position: absolute; top: 240px" Width="144px"></asp:TextBox>
        <asp:TextBox ID="txtPassword" runat="server"
            Style="z-index: 103; left: 360px;
            position: absolute; top: 272px"
            TextMode="Password" TabIndex="1" Width="144px"></asp:TextBox>
        <asp:Button ID="btLogin" runat="server"
            Style="z-index: 104; left: 320px;
            position: relative; top: 296px"
            Text="Login" TabIndex="2" />
        <asp:Label ID="Label3" runat="server"
            Font-Bold="True" ForeColor="Red"
            Style="z-index: 105; left: 520px;
            position: absolute; top: 256px"
            Text="Label" Visible="False"></asp:Label>
        <asp:Button ID="btReset" runat="server"
            Style="z-index: 106; left: 328px;
            position: relative; top: 296px"
            Text="Reset" TabIndex="3" />
        <asp:HyperLink ID="HyperLink1"
            runat="server" NavigateUrl="~/register.aspx"
            Style="z-index: 107; left: 328px;
            position: absolute; top: 352px" TabIndex="4">Click here to register.</asp:HyperLink>
        <asp:Label ID="Label4" runat="server"
            Font-Bold="True" Style="z-index: 108;
            left: 176px; position: absolute;
            top: 200px" Text="To login, enter your email address and password you used to register."></asp:Label>
        <asp:RegularExpressionValidator
            ID="RegularExpressionValidator1"
            runat="server" ControlToValidate="txtUserID"
            ErrorMessage="Not a valid Email Address"
            Font-Bold="True" Style="z-index: 109;
            left: 520px; position: absolute;
            top: 240px" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Not a valid Email Address</asp:RegularExpressionValidator>
        <asp:RegularExpressionValidator
            ID="RegularExpressionValidator3"
            runat="server" ControlToValidate="txtPassword"
            ErrorMessage="Password can only be letters or numbers!"
            Font-Bold="True" Style="z-index: 110;
            left: 520px; position: absolute;
            top: 280px" ValidationExpression="^[a-zA-Z0-9]*"></asp:RegularExpressionValidator>
        &nbsp;
        <img alt="header" src="App_Data/header.jpg" style="z-index: 112; left: 0px; position: absolute;
            top: 0px" />
    
    </div>
    </form>
</body>
</html>

Open in new window

0
OrionsXAuthor Commented:
...code-behind...
Imports Microsoft.Data.Odbc
Imports System.Web.UI
Imports System.Data.Odbc
 
 
Public Class _Default
    Inherits System.Web.UI.Page
 
    Dim conn As New conn
    Public DBCON1 As String = ConfigurationSettings.AppSettings("connstring")
 
    Protected Sub btLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btLogin.Click
 
        Dim druser As Data.OleDb.OleDbDataReader
        Dim sqlstr As String
 
        If txtUserID.Text <> "" And txtPassword.Text <> "" Then
 
            sqlstr = "SELECT user_id, passW, first_n FROM userTB WHERE user_id ='" & txtUserID.Text & "' AND passW ='" & txtPassword.Text & "'"
 
            druser = conn.getOLEDBDR(DBCON1, sqlstr)
 
            While druser.Read
                ' valid user send to home page
                Session("userID") = druser(0)
                Session("password") = druser(1)
                Session("FName") = druser(2)
            End While
 
            If txtUserID.Text = Session("userID") And txtPassword.Text = Session("password") Then
                Response.Redirect("energyUsage.aspx")
            Else : Label3.Text = "Invalid Login!"
                Label3.Visible = True
 
            End If
 
            'If Session("userid") = 0 Then
            'Label3.Text = "Invalid Login"
            'txtUserID.Text = ""
            'txtPassword.Text = ""
            'End If
 
        Else
            Label3.Text = "Cannot accept blank fields"
            Label3.Visible = True
        End If
 
    End Sub
 
    Protected Sub btReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btReset.Click
        txtUserID.Text = ""
        txtPassword.Text = ""
        Response.Redirect("login.aspx")
    End Sub
End Class

Open in new window

0
Tapan PattanaikSenior EngineerCommented:
hi OrionsX,

                  I have added this to your code and removing the other one

<asp:Image ID="Image1" runat="server" ImageUrl="~/App_Data/header.jpg" />

just copy paste the below code and mark the difference and replay me  and i am waiting for your replay.

       
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="login.aspx.vb" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server"
            Style="z-index: 100; left: 256px;
            position: absolute; top: 240px"
            Text="Email Address:"></asp:Label>
        <asp:Label ID="Label2" runat="server"
            Style="z-index: 101; left: 280px;
            position: absolute; top: 272px"
            Text="Password:"></asp:Label>
        <asp:TextBox ID="txtUserID" runat="server"
            Style="z-index: 102; left: 360px;
            position: absolute; top: 240px" Width="144px"></asp:TextBox>
        <asp:TextBox ID="txtPassword" runat="server"
            Style="z-index: 103; left: 360px;
            position: absolute; top: 272px"
            TextMode="Password" TabIndex="1" Width="144px"></asp:TextBox>
        <asp:Button ID="btLogin" runat="server"
            Style="z-index: 104; left: 320px;
            position: relative; top: 296px"
            Text="Login" TabIndex="2" />
        <asp:Label ID="Label3" runat="server"
            Font-Bold="True" ForeColor="Red"
            Style="z-index: 105; left: 520px;
            position: absolute; top: 256px"
            Text="Label" Visible="False"></asp:Label>
        <asp:Button ID="btReset" runat="server"
            Style="z-index: 106; left: 328px;
            position: relative; top: 296px"
            Text="Reset" TabIndex="3" />
        <asp:HyperLink ID="HyperLink1"
            runat="server" NavigateUrl="~/register.aspx"
            Style="z-index: 107; left: 328px;
            position: absolute; top: 352px" TabIndex="4">Click here to register.</asp:HyperLink>
        <asp:Label ID="Label4" runat="server"
            Font-Bold="True" Style="z-index: 108;
            left: 176px; position: absolute;
            top: 200px" Text="To login, enter your email address and password you used to register."></asp:Label>
        <asp:RegularExpressionValidator
            ID="RegularExpressionValidator1"
            runat="server" ControlToValidate="txtUserID"
            ErrorMessage="Not a valid Email Address"
            Font-Bold="True" Style="z-index: 109;
            left: 520px; position: absolute;
            top: 240px" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Not a valid Email Address</asp:RegularExpressionValidator>
        <asp:RegularExpressionValidator
            ID="RegularExpressionValidator3"
            runat="server" ControlToValidate="txtPassword"
            ErrorMessage="Password can only be letters or numbers!"
            Font-Bold="True" Style="z-index: 110;
            left: 520px; position: absolute;
            top: 280px" ValidationExpression="^[a-zA-Z0-9]*"></asp:RegularExpressionValidator>
        <asp:Image ID="Image1" runat="server" ImageUrl="~/App_Data/header.jpg" /></div>
    </form>
</body>
</html>

Open in new window

0
Tapan PattanaikSenior EngineerCommented:
these modified code given below working fine in my visual studio.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="login.aspx.vb" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server"
            Style="z-index: 100; left: 256px;
            position: absolute; top: 240px"
            Text="Email Address:"></asp:Label>
        <asp:Label ID="Label2" runat="server"
            Style="z-index: 101; left: 280px;
            position: absolute; top: 272px"
            Text="Password:"></asp:Label>
        <asp:TextBox ID="txtUserID" runat="server"
            Style="z-index: 102; left: 360px;
            position: absolute; top: 240px" Width="144px"></asp:TextBox>
        <asp:TextBox ID="txtPassword" runat="server"
            Style="z-index: 103; left: 360px;
            position: absolute; top: 272px"
            TextMode="Password" TabIndex="1" Width="144px"></asp:TextBox>
        <asp:Button ID="btLogin" runat="server"
            Style="z-index: 104; left: 320px;
            position: relative; top: 296px"
            Text="Login" TabIndex="2" />
        <asp:Label ID="Label3" runat="server"
            Font-Bold="True" ForeColor="Red"
            Style="z-index: 105; left: 520px;
            position: absolute; top: 256px"
            Text="Label" Visible="False"></asp:Label>
        <asp:Button ID="btReset" runat="server"
            Style="z-index: 106; left: 328px;
            position: relative; top: 296px"
            Text="Reset" TabIndex="3" />
        <asp:HyperLink ID="HyperLink1"
            runat="server" NavigateUrl="~/register.aspx"
            Style="z-index: 107; left: 328px;
            position: absolute; top: 352px" TabIndex="4">Click here to register.</asp:HyperLink>
        <asp:Label ID="Label4" runat="server"
            Font-Bold="True" Style="z-index: 108;
            left: 176px; position: absolute;
            top: 200px" Text="To login, enter your email address and password you used to register."></asp:Label>
        <asp:RegularExpressionValidator
            ID="RegularExpressionValidator1"
            runat="server" ControlToValidate="txtUserID"
            ErrorMessage="Not a valid Email Address"
            Font-Bold="True" Style="z-index: 109;
            left: 520px; position: absolute;
            top: 240px" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Not a valid Email Address</asp:RegularExpressionValidator>
        <asp:RegularExpressionValidator
            ID="RegularExpressionValidator3"
            runat="server" ControlToValidate="txtPassword"
            ErrorMessage="Password can only be letters or numbers!"
            Font-Bold="True" Style="z-index: 110;
            left: 520px; position: absolute;
            top: 280px" ValidationExpression="^[a-zA-Z0-9]*"></asp:RegularExpressionValidator>
        <asp:Image ID="Image1" runat="server" ImageUrl="~/App_Data/header.jpg" /></div>
    </form>
</body>
</html>

Open in new window

0
OrionsXAuthor Commented:
Still nothing....could this be caused by a setting somewhere?
0
Tapan PattanaikSenior EngineerCommented:
hi OrionsX,

                Check the screen shot and the code is working fine.

Thanks.
frontEnd1.JPG
frontEnd2.JPG
0
OrionsXAuthor Commented:
I believe that the code works for you but I am having no luck on my end....that's why I'm wondering if there is a configuration setting that I am missing....
0
Tapan PattanaikSenior EngineerCommented:
if you attach your pages ( code pages ) then i will try for you?
0
OrionsXAuthor Commented:
Here you go...just remove the .doc extension at the end
login.aspx.doc
login.aspx.vb.doc
0
Tapan PattanaikSenior EngineerCommented:
hi OrionsX,

I will suggest you,  use the "Request Attention" link for more help from other experts. They well help you and able to  solve your problem.  
Thanks,

Tapan pattanaik


0
OrionsXAuthor Commented:
Thanks for your help tapan, will do...
0
Bob LearnedCommented:
1) HTML <img> tags are not server controls, and don't understand the root indicator (~).

2) You tried a server control (asp:Image), with the the root path indicator, and that didn't work.

3) It is starting to sound like an rights issue.  Test that theory by moving the images to the root folder.

4) What is the authentication mode?  Is this a Web Dev server or IIS web site?

0
OrionsXAuthor Commented:
TLO,

I have tried several different path declarations for the image so you may see some things that don't quite belong. The way it is now I still see the image in design mode but not at run-time

I have moved the images to the root but no luck

Authentication mode is <authentication mode="Windows"/>

This is an IIS site (Vista)

0
Bob LearnedCommented:
How is the IIS web site directory security configured?
0
cj_1969Commented:
If you want a directory off the root of the web site just start the path with a /
i.e.  <asp:Image ID="Image1" runat="server" ImageUrl="/App_Data/header.jpg" />

So ...
- if this is IIS then the root of IIS is typically c:\inetpub\wwwroot
- then your directory would be c:\inetpub\wwwroot\App_Data
- the file header.jpg would be in this directory
0
OrionsXAuthor Commented:
Hey guys I found the answer it is as follows:
Go to Control Panel -> Programs/Features - >Turn
Windows Features On/Off -> IIS -> WWW Services -> Common HTTP Featues ->
Static Content.  I had that turned off. Once I enabled it everone was happy
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cj_1969Commented:
I'm glad you found it.
That is supposed to be on by default.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.