Enabling Server Side Includes (SSI) in IIS Web Server

22. July 2013

Enabling Server Side Includes (SSI) in IIS Web Server is a very simple to follow procedure

Step 1 : Goto Start->Control Panel 

Step 2 : Click on Programs and Features

Step 3 : Click on Turn Windows features on or off

Step 4 : Check the option Server-Side Includes under the Internet Information Services , please check the image for reference .

 

Step 5 : You are good to go , click ok and use your Server Side Includes ( SSI ) codes in html files and host under IIS Web Server . Thanks !

 

IIS ,

Enabling Server Side Includes (SSI) in Apache Web Server

22. July 2013

Enabling Server Side Includes (SSI) in Apache Web Server

You can go on this link to find the apache documentation for the same .

If you have any confusion in the apache documentation then you can follow the below steps with which i was able to enable SSI in Windows environment using WAMP 

1. First open the httpd.conf file of apache

2. Find the directory you want to enable SSI for

3. Include statement "Includes" in "Options" Directive of the directory you want SSI in, check below image for reference.

 

4. Not just any file is parsed for SSI directives. You have to tell Apache which files should be parsed. You can tell Apache to parse any file with a particular file extension, such as .shtml, with the following directives:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

Check the below image where you have to add above code :

5. We are done with configuration , now restart the apache web server and from now onwards use extension .shtml to all the files you want to have SSI code .

6 Now you can try accessing your index.shtml in web browser and it will run all the SSI codes . Thanks !

Apache ,

How to keep header,footer and other common content in separate files while using HTML

22. July 2013

How to keep header,footer and other common content in separate files while using HTML

Consider this example - you have 20 pages in your website and you have same header and footer in all of them , then what will you do ? Instead of copying and pasting the same code in all the pages , i suggest we should keep the common content in separate file and include these files to all the pages , by doing this we can modify the common content at on place and result will updated to all the pages automatically . To do this we will have to enable Server Side Includes ( SSI ) in web server .

You can check my posts to do so in Apache and IIS .

Now i presume that you have enabled the SSI in your web server . Let us code . We will keep all the content of common code in one file named header.shtml ( you must thing why shtml , shtml is to declare that this file may contain server side includes , i m declaring this so that if in future you want to add some SSI in header file also ) and will include this file in index.shtml , *.shtml so on to all the files where you want this code . 

Now we will add the following code to index.shtml ( .shtml extension is here to tell web server that it contains SSI ) where you want the header code to be included .

<!--#include virtual="header.shtml" -->

Remember 

1. <!-- #include virtual="header.shtml" --> is wrong because you gave a space in between <!-- & #include 

2. <!--#include virtual ="header.shtml" --> is wrong because you gave a space in between virtual & = 

3. <!--#include virtual="header.shtml"--> is wrong because you dint gave space in between .shtml" & -->

4. Keep in mind all the spaces as specified above before the remember heading .

 

Now as you will open the index.shtml all the content of header.shtml will be there in your file automatically.

HTML5 , , , ,

How to add font file to your website and push to client

22. July 2013

How to add font file to your website and push to client

I was searching on how to push fonts to client side if it does not have the fonts which my website require then i found this nice solution supported in CSS3 . You just have to add the below lines in your stylesheet and specify the font-family of your font file and src in url where the font file is kept on server . Rest assured your fonts will work on client side .

@font-face {

 font-family: Lucida-Calligraphy;

 src: url('fonts/LCALLIG.TTF');

 }

CSS , ,

Login.DestinationPageUrl does not work for me

4. July 2013

Login.DestinationPageUrl does not work for me

 Whenever i try to login , this control redirects to the page requested on the first place after logging in even though i have mentioned which page to open after user is logged in . Following is the solution to this :

protected void Login1_LoggedIn(object sender, EventArgs e) 

{ 

  Response.Redirect(ResolveClientUrl(Login1.DestinationPageUrl));

}

ASP.NET, C# ,