Articles → .NET → Codeplex syntax highlighter

Codeplex syntax highlighter
































Software requirement





Prerequisite knowledge













What is syntax highlighter?








using Test;





Scenario of using syntax highlighter





Download DLL









Creation of a website



Click to Enlarge




Adding DLL reference





Click to Enlarge




Click to Enlarge


Creating text file





Click to Enlarge


Adding code in a web page




using System;
using System.IO;
using ColorCode;

public partial class _Default: System.Web.UI.Page {
  protected void Page_Load(object sender, EventArgs e) {
    string code = File.ReadAllText(Server.MapPath(@"~\code.txt"));
    string colorCode = new CodeColorizer().Colorize(code, Languages.Aspx);

    Response.Write(colorCode);
  }
}



Code explained







Run application





Click to Enlarge


Conclusion





Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, February 14, 2012

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250