Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Computer Details

Posted on September 17, 2013October 26, 2015 By David Kittell
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ComputerDetails.aspx.cs"
    Inherits="ComputerName" %>

<!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>Computer Details</title>
</head>
<body>
    <form id="form1" runat="server">
    <table cellpadding="2" cellspacing="0" border="0">
        <tr>
            <td>
                Windows User:
            </td>
            <td>
                <asp:TextBox ID="WindowsUser" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                Machine Name:
            </td>
            <td>
                <asp:TextBox ID="MachineName" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                Machine IP:
            </td>
            <td>
                <asp:TextBox ID="MachineIP" runat="server" />
            </td>
        </tr>
        <tr>
            <td valign="top">
                Browser Details:
            </td>
            <td>
                <asp:TextBox ID="BrowserDetails" runat="server" />
            </td>
        </tr>
        <tr>
            <td valign="top">
                Date Time:
            </td>
            <td>
                <asp:TextBox ID="TimeStamp" runat="server" />
            </td>
        </tr>
    </table>
    </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 ComputerName : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Web.HttpBrowserCapabilities browser = Request.Browser;
        string s = "Browser Capabilitiesn"
        + "Type = " + browser.Type + "n"
        + "Name = " + browser.Browser + "n"
        + "Version = " + browser.Version + "n"
        + "Major Version = " + browser.MajorVersion + "n"
        + "Minor Version = " + browser.MinorVersion + "n"
        + "Platform = " + browser.Platform + "n"
        + "Is Beta = " + browser.Beta + "n"
        + "Is Crawler = " + browser.Crawler + "n"
        + "Is AOL = " + browser.AOL + "n"
        + "Is Win16 = " + browser.Win16 + "n"
        + "Is Win32 = " + browser.Win32 + "n"
        + "Supports Frames = " + browser.Frames + "n"
        + "Supports Tables = " + browser.Tables + "n"
        + "Supports Cookies = " + browser.Cookies + "n"
        + "Supports VBScript = " + browser.VBScript + "n"
        + "Supports JavaScript = " +
            browser.EcmaScriptVersion.ToString() + "n"
        + "Supports Java Applets = " + browser.JavaApplets + "n"
        + "Supports ActiveX Controls = " + browser.ActiveXControls
              + "n"
        + "Supports JavaScript Version = " +
            browser["JavaScriptVersion"] + "n";


        //if (browser.Browser != "IE")
        //{
        //    Response.Write("Only Internet Explorer is supported.");
        //    Response.End();
        //}
        //else
        //{
        //    BrowserDetails.Text = s;
        //}

        BrowserDetails.Text = browser.Browser + " " + browser.Version;

        string[] computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' });
        String ecn = System.Environment.MachineName;
        MachineName.Text = computer_name[0].ToString().ToUpper();

        System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
        WindowsUser.Text = p.Identity.Name.Replace("<Windows Domain>", "");

        MachineIP.Text = Request.ServerVariables["remote_addr"];
        TimeStamp.Text = DateTime.Now.ToString();
    }
}
Originally Posted on September 17, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

C# ASPX Code CSharp

Post navigation

Previous post
Next post

Related Posts

Ektron – DMS Content List

Posted on October 31, 2014October 26, 2015

<%@ Page Title="" Language="C#" CodeFile="DMSFileList.aspx.cs" Inherits="DMSFileList" %> <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <meta charset="utf-8" /> <title>DMS File List</title> </head> <body> <form id="form1" runat="server"> <asp:Repeater ID="subContentRepeater" runat="server"> <HeaderTemplate> <table style="border: 1px solid #000000;"> <tr> <th>ID</th> <th>Type</th> <th>QuickLink</th> <th>Title</th> <th>Summary</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td style="vertical-align: text-top;"> <%# DataBinder.Eval(Container.DataItem,…

Read More

WordPress – Backup & Restore

Posted on January 28, 2016February 22, 2016

I have this in these two posts (CentOS – WordPress Install and Ubuntu – WordPress Install) but thought it may be best to create a separate post to help focus on this process. After writing this post I came across a site that I do not have SSH/CLI access to…

Read More

SharePoint Web Service

Posted on September 10, 2015

Microsoft SharePoint offers a web service to query and use to simplify jobs that typically you’d have to need a connection to active directory. Some Basic URLs: http://(Your SharePoint URL)/_vti_bin/UserProfileService.asmx http://(Your SharePoint URL)/_vti_bin/Lists.asmx http://(Your SharePoint URL)/_vti_bin/UserGroup.asmx From within http://(Your SharePoint URL)/_vti_bin/UserProfileService.asmx you can pull these details UserProfile_GUID, AccountName, FirstName, LastName,…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes