Thursday 1 December 2011

How to Get Server Name and Server Port No in Asp.Net from Request Object




string link = "http://" + Request.ServerVariables["server_name"].ToString();
                if (Request.ServerVariables["SERVER_PORT"].ToString() !=null &&
Request.ServerVariables["SERVER_PORT"].ToString() != "")


 
                {
                    link += ":" + Request.ServerVariables["SERVER_PORT"].ToString().Trim() +"/WebSiteDomainName";
                }
                link += "/Varification.aspx?vc=" + UserInfo.Tables[0].Rows[0]["Aid"].ToString().Trim() + "&un=" + username.Text.Trim();

No comments:

Post a Comment