How can I add an image to the title of a web application (something like facebook logo in head title)
<head id="Head1" runat="server">
<asp:ContentPlaceHolder ID="Head_Title" runat="server">
</asp:ContentPlaceHolder>
</head>
============================================================================
<%# Control Language="C#" AutoEventWireup="true" CodeFile="Head_Title.ascx.cs" Inherits="Controls_Head_Title" %>
<title>
website
||
<%= title %>
</title>
how can I add it ?
<head>
<link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
<link rel="icon" type="image/ico" href="/favicon.ico" />
<link rel="apple-touch-icon" type="image/ico" href="/favicon.ico" />
</head>
Create your image as an ICO or PNG (16x16) and put it in your root folder.
You should have an icon and link it as below
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
Convert The Image Into 16X16 pixels (Image which you want See As tittle Image).
Only .ico Image will work as a tittle image so convert your image into .ico . For converting visit
http://www.favicon.cc/ and import you image and download Fevicon
place the image in root folder of your project Ex- /images/Logo.ico
use
<link rel="shortcut icon" href="/images/Logo.ico"
type="image/x-icon" />
tag in head section of your asp.net page.
Your Done...!!!
Related
I have asp .net 4.0 application in which i am implementing url routing. I have defined my routes in global asax and able to call them correctly.
but my problem is when I am calling a route with parameters my css was not binded properly .
I linked my css files as follows in my master page.
<link id="Link1" rel="stylesheet" type="text/css" href="~/css/style.css" runat="server" />
<link id="Link2" rel="stylesheet" type="text/css" href="~/css/menu.css" runat="server" />
when i am calling a route with a page my css bindings are being changed as follows in my page source behind.
<link id="Link1" rel="stylesheet" type="text/css" href="css/style.css" />
<link id="Link2" rel="stylesheet" type="text/css" href="css/menu.css" />
and when there is a route value
<link id="Link1" rel="stylesheet" type="text/css" href="../css/style.css" />
<link id="Link2" rel="stylesheet" type="text/css" href="../css/menu.css" />
when i have two route values
<link id="Link1" rel="stylesheet" type="text/css" href="../../css/style.css" />
<link id="Link2" rel="stylesheet" type="text/css" href="../../css/menu.css" />
AND the following piece of code in global asax.cs worked for me.
Routes.Ignore("{folder}/{*pathInfo}", new { folder = "my images path" });
I've been searching for an explanation as to why the following won't execute on the server
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link href="<%=CurrentUser.ses.style.css%>" type="text/css" rel="stylesheet">
</head>
But the following will execute just fine
<link href="<%=CurrentUser.ses.style.css%>" type=text/css rel="stylesheet">
(notice the missing "")
I've even tried
<link href="<%=CurrentUser.ses.style.css%>" type="<%=Response.ContentType = "text/css" %>" rel="stylesheet">
But that will change the contenttype for the page and serve it all as being css.
What am I doing wrong?
try this ?
<link href="<%= String.Format("{0}",CurrentUser.ses.style.css)%>" type="text/css" rel="stylesheet">
I am trying to load stylesheet dynamically from folder, but currently, it isn't working:
<head id="Head1" runat="server">
<link type="text/css" rel="styleSheet" href="http://www.domain.com/users/'<%= UserNameVar%>'/styleSheet.css" />
</head>
UserNameVar contains string data.
Edit: This is the output when i upload it to server. but it is not loading
<link type="text/css" rel="styleSheet" href="http://www.domain.com/users/'<%= UserNameVar%>'/styleSheet.css" /></head>
Put all href value in <%= and %>
Try this:
<head id="Head1" runat="server">
<link type="text/css" rel="styleSheet" href=<%= "http://www.domain.com/users/" + UserNameVar + "/styleSheet.css />" %>
</head>
I have Created New MVC2 ViwUserControl
and I have added new css file to ~/Content/Styles folder in my solution explorer.
but my user control is not retrieving CSS files
<link href="~/Content/Styles/demo_page.css" rel="stylesheet" type="text/css" />
<link href="~/Content/Styles/demo_table.css" rel="stylesheet" type="text/css" />
<link href="~/Content/Styles/demo_validation.css" rel="stylesheet" type="text/css" />
<link href="~/Content/Styles/jquery.alerts.css" rel="stylesheet" type="text/css" />
<link href="~/Content/Styles/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="~/Content/Styles/jquery-ui-1.7.2.custom.css" rel="stylesheet" type="text/css" />
any ideas/help appreciated?
when i debug through the firbug i'm seeing 404 not found error for these files
The preceding tilde is throwing your code off ...
Change:
<link href="~/ ...
To:
<link href="/ ...
The tilde ~ is a server-side construct commonly used in ASP.Net WebForms with code like:
<img runat="server" src="~/Images/foo.png" />.
In MVC the standard is to use #Url.Content(" ... "); so:
<link href="#Url.Content("~/Content/Styles/demo_page.css")"
rel="stylesheet" type="text/css" />
You cannot use ~/ in html. the only works with server-side function that support that vritual path. Remove ~
In my view, I have included the Master page as follows:
<%# Page Title=""
Language="C#" MasterPageFile="~/Views/Shared/Mall.Master"
Inherits="System.Web.Mvc.ViewPage<DomainModel.Entities.Seller>" %>
And in my Mall.master file, I add a link to include a general css file
<link rel="Stylesheet" href="../../Content/MallMaster.css" type="text/css" />
However, I need another more specific purpose css file CheckOut.css in my view. Since the style defined in Checkout.css only applies for one page, I do not want to include the file in the master page. Is there any way to include the file in my view?
You should add a new content () placeholder in your MasterPage and then in your view you can add another css to this placeholder.
<asp:ContentPlaceHolder ID="head" runat="server">
<title></title>
<link rel="Stylesheet" href="../../Content/MallMaster.css" type="text/css" />
</asp:ContentPlaceHolder>
This may be helpful for you - How to pass page’s meta tags in ASP.NET MVC?
If you don't want to override existing tags in the master, you can add a content placeholder inside the head tag too:
<head runat="server">
<title>
<asp:ContentPlaceHolder ID="title" runat="server">
Default Title</asp:ContentPlaceHolder>
</title>
<!-- The ContentPlaceHolder is placed inside the title tag to make sure that the
document validates in the VS editor - <title> needs to be a direct child of
<head>. The output will validate. -->
<script src="theAllFamous_jQuery.js" type="text/javascript" />
<link href="sitewide.css" type="text/css" rel="Stylesheet" />
<asp:ContentPlaceHolder ID="headContent" runat="server />
</head>
And in your view:
<asp:Content ID="title" ContendPlaceHolderId="title" runat="server">
Page specific title
</asp:Content>
<asp:Content ID="head" ContentPlaceHolderId="headContent" runat="server">
<link href="pagespecific.css" type="text/css/ rel="Stylesheet" />
</asp:Content>
That way you won't have to duplicate code that you want in all head tags on your site.