I have an image that image that is set for the upper left hand side of my site. It will appear on all pages, with the exception of the pages associated to the user account (login, registration, etc...stored in a sub folder called "Account". If I move an
account page out of the folder and place it under the main directory, the image does appear. The code is as follows...can anyone tell me why the "Account" folder is blocking the image from appearing?
You can try to write the Layout in the pages for example in every page in Account folder you can use
@{
Layout = "SiteLayout.cshtml";
}
and in every other page
@{
Layout = "SiteLayout2.cshtml";
}
Where you can make the photo availabe in one layout page and make it disappear in the other one!
But if dont want to do that. You can try doing something else like getting the Url data and than choose what to do if the user is present in the location.
Also in your code you have not present any operator for your image src
kookoomoo
Member
54 Points
92 Posts
Image Display Issue
Nov 06, 2012 11:51 AM|LINK
Hello,
I have an image that image that is set for the upper left hand side of my site. It will appear on all pages, with the exception of the pages associated to the user account (login, registration, etc...stored in a sub folder called "Account". If I move an account page out of the folder and place it under the main directory, the image does appear. The code is as follows...can anyone tell me why the "Account" folder is blocking the image from appearing?
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>@Page.Title - Mumba</title> <link href="@Href("~/Styles/Site.css")" rel="stylesheet" /> <link href="@Href("~/favicon.ico")" rel="shortcut icon" type="image/x-icon" /> @if (IsSectionDefined("AddToHead")) { @RenderSection("AddToHead", false) } @RenderSection("Scripts", false) </head> <body> <div id="page"> <div id="header"> <img class="site-logo" src="Images/Default/Site_Logo.jpg" alt="Logo" /> <p class="site-title">The Monthly Estate...<span style="font-size: .8em"5>Making Real Estate Easier</span></p> <div id="login"> @if (WebSecurity.IsAuthenticated) { <p> <a href="@Href("~/Account/ChangePassword")" title="Change password">@WebSecurity.CurrentUserName</a> <a href="@Href("~/Account/Logout")">| Logout</a> </p> } else { <ul> <li><a href="@Href("~/Account/Register")">Register</a></li> <li><a href="@Href("~/Account/Login")">Login</a></li> </ul> } </div> <ul id="menu"> <li><a href="@Href("~/")">HOME</a></li> <li><a href="@Href("~/TheMonthlyEstate")">THE MONTHLY ESTATE</a></li> <li><a href="@Href("~/ThePlan")">THE PLAN</a></li> <li><a href="@Href("~/Social")">SOCIAL MARKETING</a></li> <li><a href="@Href("~/Members")">MEMBERS</a></li> </ul> </div> <div id="main"> <div id="content"> @RenderBody() </div> <div id="footer"> © @DateTime.Now.Year - Mumba.me | <a href="ContactUs" style="text-decoration: none; color: #606060" >Contact Us</a> </div> </div> </div> </body> </html>Thanks!
Mikesdotnett...
All-Star
154941 Points
19870 Posts
Moderator
MVP
Re: Image Display Issue
Nov 06, 2012 12:32 PM|LINK
Try using the Href helper on the image:
<img class="site-logo" src="@Href("~/Images/Default/Site_Logo.jpg")" alt="Logo" />Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
Afzaal.Ahmad...
Contributor
2661 Points
1040 Posts
Re: Image Display Issue
Nov 06, 2012 05:57 PM|LINK
There are many possible ways to do this.
You can try to write the Layout in the pages for example in every page in Account folder you can use
@{ Layout = "SiteLayout.cshtml"; }and in every other page
@{ Layout = "SiteLayout2.cshtml"; }Where you can make the photo availabe in one layout page and make it disappear in the other one!
But if dont want to do that. You can try doing something else like getting the Url data and than choose what to do if the user is present in the location.
Also in your code you have not present any operator for your image src
Write as
<div></div>~~! FIREWALL !~~