Page

How to Install IIS (Internet Information Services) Manager in Windows 8/8.1

Introduction:

Here I will explain how to install IIS (internet information services) manager in windows 8 or 8.1. If we want run our web applications we need to install IIS manager actually it’s optional windows feature that’s the reason we need to install manually.


STEP 1.

To install IIS manger Open Run command prompt and enter like as shown below



Otherwise go to START à Control Panel à Programs à Turn Windows Features on or off à Internet Information Services à Web Management Tools à Check or select IIS Management Console à Click OK like as shown below


STEP 2.

Once we click OK it will install required files like as shown below



STEP 3.

Now open RUN Command window and type “inetmgr” and click OK to check IIS installed or not if it installed it will open IIS manager like as shown below



I hope it helps you to install IIS in windows 8 or 8.1…….. Happy sourcecoding…..



Accordion menu with dynamic links in asp.net


// WebForm.aspx //

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm.aspx.cs" Inherits="AccordionMenu.WebForm" %>

<!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></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<script type="text/javascript" src="Scripts/ddaccordion.js">

</script>


<script type="text/javascript">


    ddaccordion.init({
        headerclass: "silverheader", //Shared CSS class name of headers group
        contentclass: "submenu", //Shared CSS class name of contents group
        revealtype: "mouseover", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
        mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
        collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
        defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc] [] denotes no content
        onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)
        animatedefault: false, //Should contents open by default be animated into view?
        persiststate: true, //persist state of opened contents within browser session?
        toggleclass: ["", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
        togglehtml: ["", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
        animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
        oninit: function (headers, expandedindices) { //custom code to run when headers have initalized
            //do nothing
        },
        onopenclose: function (header, index, state, isuseractivated) { //custom code to run whenever a header is opened or closed
            //do nothing
        }
    })


</script>


<style type="text/css">

.applemenu{
margin: 5px 0;
padding: 0;
width: 170px; /*width of menu*/
border: 1px solid #9A9A9A;
}

.applemenu div.silverheader a{
background: black url(images/silvergradient.gif) repeat-x center left;
font: normal 12px Tahoma, "Lucida Grande", "Trebuchet MS", Helvetica, sans-serif;
color: white;
display: block;
position: relative; /*To help in the anchoring of the ".statusicon" icon image*/
width: auto;
padding: 5px 0;
padding-left: 8px;
text-decoration: none;
}


.applemenu div.silverheader a:visited, .applemenu div.silverheader a:active{
color: white;
}


.applemenu div.selected a, .applemenu div.silverheader a:hover{
background-image: url(images/silvergradientover.gif);
color: white;
}

.applemenu div.submenu{ /*DIV that contains each sub menu*/
background: white;
padding: 5px;
height: 300px; /*Height that applies to all sub menu DIVs. A good idea when headers are toggled via "mouseover" instead of "click"*/
}

</style>
</head>
<body>
    <form id="form1" runat="server">
   <div>
   <div class="applemenu">
        <div class="silverheader"><asp:LinkButton ID="lnkNational" runat="server">National Members</asp:LinkButton></div>
            <div class="submenu">
            <asp:Panel ID="pnlCountries" runat="server"></asp:Panel>
            <br />
            </div>
        <div class="silverheader"><asp:LinkButton ID="lnkState" runat="server">State Members</asp:LinkButton></div>
            <div class="submenu">
            <asp:Panel ID="pnlStates" runat="server"></asp:Panel>
            <br />
            </div>
        <div class="silverheader"><asp:LinkButton ID="lnkDistrict" runat="server">District Members</asp:LinkButton></div>
            <div class="submenu">
            <asp:Panel ID="pnlDistricts" runat="server"></asp:Panel>
            <br />
            </div>    
    </div>



    </div>
    </form>
</body>
</html>

// WebForm.aspx.cs //


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AccordionMenu
{
    public partial class WebForm7 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            LinkButton lic1 = new LinkButton();
            lic1.Text = "India";
            lic1.PostBackUrl = "#";
            LinkButton lic2 = new LinkButton();
            lic2.Text = "China";
            lic2.PostBackUrl = "#";
            Table tbc = new Table();
            TableRow trc1 = new TableRow();
            TableRow trc2 = new TableRow();
            TableCell tcc1 = new TableCell();
            TableCell tcc2 = new TableCell();
            tcc1.Controls.Add(lic1);
            tcc2.Controls.Add(lic2);
            trc1.Cells.Add(tcc1);
            trc2.Cells.Add(tcc2);
            tbc.Rows.Add(trc1);
            tbc.Rows.Add(trc2);
            pnlCountries.Controls.Add(tbc);

            LinkButton lis1 = new LinkButton();
            lis1.Text = "Kerala";
            LinkButton lis2 = new LinkButton();
            lis2.Text = "Tamilnadu";
            Table tbs = new Table();
            TableRow trs1 = new TableRow();
            TableRow trs2 = new TableRow();
            TableCell tcs1 = new TableCell();
            TableCell tcs2 = new TableCell();
            tcs1.Controls.Add(lis1);
            tcs2.Controls.Add(lis2);
            trs1.Cells.Add(tcs1);
            trs2.Cells.Add(tcs2);
            tbs.Rows.Add(trs1);
            tbs.Rows.Add(trs2);
            pnlStates.Controls.Add(tbs);

            LinkButton lid1 = new LinkButton();
            lid1.Text = "Ernakulam";
            LinkButton lid2 = new LinkButton();
            lid2.Text = "Trissur";
            Table tbd = new Table();
            TableRow trd1 = new TableRow();
            TableRow trd2 = new TableRow();
            TableCell tcd1 = new TableCell();
            TableCell tcd2 = new TableCell();
            tcd1.Controls.Add(lid1);
            tcd2.Controls.Add(lid2);
            trd1.Cells.Add(tcd1);
            trd2.Cells.Add(tcd2);
            tbd.Rows.Add(trd1);
            tbd.Rows.Add(trd2);
            pnlDistricts.Controls.Add(tbd);
        }
    }
}

Display Data in HTML Table from Database using Asp.net in C#

// Example.aspx //

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Example.aspx.cs" Inherits="_Example" %>  
<!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>Display Data from Database in HTML Table in asp.net</title>  
</head>  
<body>  
<form id="form1" runat="server">
<div>
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</div>
</form>
</body>
</html>


// Example.aspx.cs //

using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web.UI.WebControls;

public partial class Example : System.Web.UI.Page
{

SqlConnection scon = new SqlConnection("Your Connection String");
StringBuilder htmlTable = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
using (SqlCommand scmd = new SqlCommand())
{
scmd.Connection = scon;
scmd.CommandType = CommandType.Text;
scmd.CommandText = "SELECT * FROM Information";
scon.Open();
SqlDataReader articleReader = scmd.ExecuteReader();

htmlTable.Append("<table border='1'>");
htmlTable.Append("<tr><th>SlNo.</th><th>Name</th><th>Mobile Number</th><th>EmailId</th></tr>");

if (articleReader.HasRows)
{
while (articleReader.Read())
{
htmlTable.Append("<tr>");
htmlTable.Append("<td>" + articleReader["ID"]+ "</td>");
htmlTable.Append("<td>" + articleReader["Name"] + "</td>");
htmlTable.Append("<td>" + articleReader["Mobno"] + "</td>");
htmlTable.Append("<td>" + articleReader["EmailId"] + "</td>");
htmlTable.Append("</tr>");
}
htmlTable.Append("</table>");

PlaceHolder1.Controls.Add(new Literal { Text = htmlTable.ToString() });

articleReader.Close();
articleReader.Dispose();
}
}
}
}

// SQL Table //






Count Number of Visitors in Website using Asp.net in C#

// Global.asax //

void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Application["NoOfVisitors"] = 0;
}

void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
Application.Lock();
Application["NoOfVisitors"] = (int)Application["NoOfVisitors"] + 1;
Application.UnLock();
}


// Example.aspx //


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Example.aspx.cs" Inherits="_Example" %>  
  
<!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> Count Page Hit</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
   <table>
<tr>
<td>
<b>You are Visitor Number:</b>
</td>
<td>
<asp:Label ID="lblCount" runat="server" ForeColor="Red" />
</td>
</tr>
</table>
</form>
</body>
</html>



// Example.aspx.cs //


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

public partial class Example : System.Web.UI.Page
{

  protected void Page_Load(object sender, EventArgs e)
    {
lblCount.Text = Application["NoOfVisitors"].ToString();
    }
}



// OUTPUT //




Login Page and Logout Page Code using Cookies and Sessions

// LOGIN Code //


using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session.RemoveAll();  //it Removes all Sessions that previously stored
}
// the Below code is for the Login Code in Buttion1_Click
protected void Button1_Click(object sender, EventArgs e)
{
string connetionString = null;
SqlConnection connection;
SqlCommand command;
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds = new DataSet();
string sql = null;
connetionString = “Your Connection String”;
sql = “select * from login where username='” + TextBox1.Text + “‘ AND Password='” + TextBox2.Text + “‘”;
connection = new SqlConnection(connetionString);
connection.Open();
command = new SqlCommand(sql, connection);
adapter.SelectCommand = command;
adapter.Fill(ds,”tempLogin”);
adapter.Dispose();
command.Dispose();
connection.Close();

//This Code is used for the Useraname and Password Checking
if (ds.Tables[0].Rows.Count>0
{
Session[“x”] = TextBox1.Text;
Session.Timeout = 1;
HttpCookie c = new HttpCookie(“userdetails”);
c[“user name”] = TextBox1.Text;
//c[“Password”] = TextBox2.Text;
c.Expires = DateTime.Now.AddMinutes(1);
Response.Cookies.Add(c);
Response.Redirect(“Home.aspx”);
}
}
}


// LOGOUT Code //


using System.Collections;
public partial class Home : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// This Code is used to Disable the Browser “BACK Button”
Response.ClearHeaders();
Response.AppendHeader(“Cache-Control”, “no-cache”); //HTTP 1.1
Response.AppendHeader(“Cache-Control”, “private”); // HTTP 1.1
Response.AppendHeader(“Cache-Control”, “no-store”); // HTTP 1.1
Response.AppendHeader(“Cache-Control”, “must-revalidate”); // HTTP 1.1
Response.AppendHeader(“Cache-Control”, “max-stale=0″); // HTTP 1.1
Response.AppendHeader(“Cache-Control”, “post-check=0″); // HTTP 1.1
Response.AppendHeader(“Cache-Control”, “pre-check=0″); // HTTP 1.1
Response.AppendHeader(“Pragma”, “no-cache”); // HTTP 1.1
Response.AppendHeader(“Keep-Alive”, “timeout=3, max=993″); // HTTP 1.1
Response.AppendHeader(“Expires”, “Mon, 26 Jul 1997 05:00:00 GMT”); // HTTP 1.1
//This code is used to maintain UserName in the Home page using Session and Cookies
        if (Session[“x”] == null)
{
Response.Redirect(“Default.aspx”);
}
else
{
IEnumerator mc;
mc = Request.Cookies.AllKeys.GetEnumerator();
while (mc.MoveNext())
{
if (Request.Cookies[mc.Current.ToString()].HasKeys == true)
{
IEnumerator sc;
sc = Request.Cookies[mc.Current.ToString()].Value.GetEnumerator();
while (sc.MoveNext())
{
Response.Write(sc.Current.ToString() + Request.Cookies[mc.Current.ToString()][sc.Current.ToString()]);
}
}
}
}
}
//This Code is for the LOGOUT Code
protected void Button1_Click(object sender, EventArgs e)
{
Session.Clear();
Session.RemoveAll();
Session.Abandon();
Response.Redirect(“Default.aspx”, true);
}
}