Solved

Get hostname & display on screen...

Posted on 2006-07-13
2
313 Views
Last Modified: 2012-06-21
I have some code which looks like this:
<%@ Register TagPrefix="SMWC" Namespace="SSWeb.Skins._controls" Assembly="SSWeb" %>
<%@ Page language="C#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="SSWeb.Login" %>
<%@ Register TagPrefix="STWC" Namespace="SmarterTools.Web.Controls" Assembly="SmarterTools.Web" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <META name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
            <META name="CODE_LANGUAGE" content="C#">
            <META name="vs_defaultClientScript" content="JavaScript">
            <META name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
            <LINK href="Skins/_default/Skin.css" type="text/css" rel="stylesheet">
      </HEAD>
      <BODY>
            <form id="Form1" method="post" runat="server">
                  <ASP:TEXTBOX id="txtSiteID" runat="server" wrap="False" maxlength="250" width="200" columns="25"></ASP:TEXTBOX>
                  <!-- more ... //-->
            </form>
      </BODY>
</HTML>

Basically, I want the txtSiteID to have the address hostname, so if the address bar was showing this:
http://www.domain.tld/site.aspx

I would like the txtSiteID to have a value of:
'www.domain.tld'

As you can see this may not be stright forwards as I have some CodeBehind and Inherits, and I'm not 100% sure how this works with the current form. I also do not have access to it's code.
0
Comment
Question by:aproxity
2 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 17100860
try this:

Dim hostname as String=Environment.MachineName
0
 
LVL 4

Accepted Solution

by:
svy earned 300 total points
ID: 17101123
use Request.Url.Host

MachineName can be different from actual HostName
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now