Code on Global.asax File
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
SqlConnection con = new SqlConnection("Data Source=XAPRIO-PC;Initial Catalog=URLDB;Persist Security Info=True;User ID=sa;Password=123");
con.Open();
string strCmd = "SELECT * FROM tblRoute";
SqlDataAdapter da = new SqlDataAdapter(strCmd, con);
DataTable dt = new DataTable();
da.Fill(dt);
foreach (DataRow row in dt.Rows)
{
RouteTable.Routes.MapPageRoute(row["PageRouteName"].ToString(), row["PageRouteURL"].ToString(), row["PagePhysicalPath"].ToString());
}
con.Close();
}
Create Table
Run your application and enter url "Route/Home" for Default.aspx
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
SqlConnection con = new SqlConnection("Data Source=XAPRIO-PC;Initial Catalog=URLDB;Persist Security Info=True;User ID=sa;Password=123");
con.Open();
string strCmd = "SELECT * FROM tblRoute";
SqlDataAdapter da = new SqlDataAdapter(strCmd, con);
DataTable dt = new DataTable();
da.Fill(dt);
foreach (DataRow row in dt.Rows)
{
RouteTable.Routes.MapPageRoute(row["PageRouteName"].ToString(), row["PageRouteURL"].ToString(), row["PagePhysicalPath"].ToString());
}
con.Close();
}
Create Table
Run your application and enter url "Route/Home" for Default.aspx