Solved

Get hostname & display on screen...

Posted on 2006-07-13
2
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

729 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