Solved

Get hostname & display on screen...

Posted on 2006-07-13
2
317 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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