Translate
Tuesday, 30 June 2015
Thursday, 18 June 2015
get ip address in c#
//using System.Net;
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
string myIP = Dns.GetHostByName(hostName).AddressList[0].ToString();
Response.Write("My IP Address is :" + myIP);
or
-------
string ip_address = Convert.ToString(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);
Response.Write("My IP Address is :" + ip_address);
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
string myIP = Dns.GetHostByName(hostName).AddressList[0].ToString();
Response.Write("My IP Address is :" + myIP);
or
-------
string ip_address = Convert.ToString(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);
Response.Write("My IP Address is :" + ip_address);
C#- different type of alert message in code behind
string Message = "Pabitra you as Microsoft Employee !";
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Pabitra you as Microsoft Employee !');", true);
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + Message + "');", true);
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Pabitra you as Microsoft Employee !');", true);
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + Message + "');", true);
Response.Write(@"<script language='javascript'>alert('Pabitra you as Microsoft Employee ! ')</script>");
Response.Write(@"<script language='javascript'>alert('"+Message+"')</script>");
Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('Pabitra you as Microsoft Employee !');</script>");
Page.ClientScript.RegisterStartupScript(Page.GetType(),"MessageBox","<script language='javascript'>alert('" + Message + "');</script>");
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('Pabitra you as Microsoft Employee !')", true);
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('" + Message + "')", true);
////////////////
ClientScript.RegisterClientScriptBlock(GetType(), "Email", "GetEmail();", true);
//In Html Page
<head>
<script type="text/javascript" language="javascript">
function GetEmail() {
alert('hi');
}
</script>
</head>
///////////////////////////
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Pabitra you as Microsoft Employee !');", true);
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + Message + "');", true);
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Pabitra you as Microsoft Employee !');", true);
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + Message + "');", true);
Response.Write(@"<script language='javascript'>alert('Pabitra you as Microsoft Employee ! ')</script>");
Response.Write(@"<script language='javascript'>alert('"+Message+"')</script>");
Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('Pabitra you as Microsoft Employee !');</script>");
Page.ClientScript.RegisterStartupScript(Page.GetType(),"MessageBox","<script language='javascript'>alert('" + Message + "');</script>");
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('Pabitra you as Microsoft Employee !')", true);
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('" + Message + "')", true);
////////////////
ClientScript.RegisterStartupScript(this.GetType(), "Email", "<script>GetEmail();</script>");
ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert('Please Enter Data')", true);
ClientScript.RegisterClientScriptBlock(GetType(), "Email", "GetEmail();", true);
//In Html Page
<head>
<script type="text/javascript" language="javascript">
function GetEmail() {
alert('hi');
}
</script>
</head>
///////////////////////////
Wednesday, 17 June 2015
custom message in asp.nt
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnClick" runat="server" Text="Click Me" OnClick="btnClick_Click" />
</div>
</form>
</body>
</html>
---------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnClick_Click(object sender, EventArgs e)
{
CustomPopup.Show(this.Page, "Hello Pabitra Microsoft");
}
}
public static class CustomPopup
{
public static void Show(this Page Page, String Message)
{
Page.ClientScript.RegisterStartupScript(Page.GetType(),"MessageBox","<script language='javascript'>alert('" + Message + "');</script>");
}
}
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnClick" runat="server" Text="Click Me" OnClick="btnClick_Click" />
</div>
</form>
</body>
</html>
---------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnClick_Click(object sender, EventArgs e)
{
CustomPopup.Show(this.Page, "Hello Pabitra Microsoft");
}
}
public static class CustomPopup
{
public static void Show(this Page Page, String Message)
{
Page.ClientScript.RegisterStartupScript(Page.GetType(),"MessageBox","<script language='javascript'>alert('" + Message + "');</script>");
}
}
c# Page.ClientScript.RegisterStartupScript
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('Hello Mr Pabitra Now your eligible for join in microsoft');window.location.href=('Thanku.aspx');</script>");
Subscribe to:
Posts (Atom)