Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added project files

  • Loading branch information...
commit 99dd11486e08236ec7a3d6f7665d2ce2237b579c 0 parents
Robert Greiner authored March 02, 2011
26  .gitignore
... ...
@@ -0,0 +1,26 @@
  1
+Thumbs.db
  2
+*.obj
  3
+*.exe
  4
+*.pdb
  5
+*.user
  6
+*.aps
  7
+*.pch
  8
+*.vspscc
  9
+*_i.c
  10
+*_p.c
  11
+*.ncb
  12
+*.suo
  13
+*.tlb
  14
+*.tlh
  15
+*.bak
  16
+*.cache
  17
+*.ilk
  18
+*.log
  19
+[Bb]in
  20
+[Dd]ebug*/
  21
+*.lib
  22
+*.sbr
  23
+obj/
  24
+[Rr]elease*/
  25
+_ReSharper*/
  26
+[Tt]est[Rr]esult*
17  LICENSE.txt
... ...
@@ -0,0 +1,17 @@
  1
+OPEN SOURCE PUBLIC LICENSE
  2
+Version 1, October 2010
  3
+
  4
+http://www.ospl.ws
  5
+
  6
+Copyright (C) 2010 Robert Greiner
  7
+robert@robertgreiner.com
  8
+
  9
+Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
  10
+
  11
+OPEN SOURCE PUBLIC LICENSE
  12
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  13
+
  14
+0. The work released under this license can be used, modified, distributed, and/or released free of charge and royalty free.
  15
+1. No attribution is required for any reason during the use of the work released under this license.
  16
+2. There is no warranty provided for the work released under this license.
  17
+3. The copyright holder and any modifier cannot be held liable for any damages occurred during the use of this work.
20  myIP.sln
... ...
@@ -0,0 +1,20 @@
  1
+
  2
+Microsoft Visual Studio Solution File, Format Version 11.00
  3
+# Visual Studio 2010
  4
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "myIP", "myIP\myIP.csproj", "{1A90B7E7-E55A-403F-A800-3615B97EAA66}"
  5
+EndProject
  6
+Global
  7
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
  8
+		Debug|Any CPU = Debug|Any CPU
  9
+		Release|Any CPU = Release|Any CPU
  10
+	EndGlobalSection
  11
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
  12
+		{1A90B7E7-E55A-403F-A800-3615B97EAA66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  13
+		{1A90B7E7-E55A-403F-A800-3615B97EAA66}.Debug|Any CPU.Build.0 = Debug|Any CPU
  14
+		{1A90B7E7-E55A-403F-A800-3615B97EAA66}.Release|Any CPU.ActiveCfg = Release|Any CPU
  15
+		{1A90B7E7-E55A-403F-A800-3615B97EAA66}.Release|Any CPU.Build.0 = Release|Any CPU
  16
+	EndGlobalSection
  17
+	GlobalSection(SolutionProperties) = preSolution
  18
+		HideSolutionNode = FALSE
  19
+	EndGlobalSection
  20
+EndGlobal
16  myIP/Default.aspx
... ...
@@ -0,0 +1,16 @@
  1
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="myIP.Default" %>
  2
+
  3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4
+
  5
+<html xmlns="http://www.w3.org/1999/xhtml">
  6
+<head runat="server">
  7
+    <title>My IP Address</title>
  8
+</head>
  9
+<body>
  10
+    <form id="form1" runat="server">
  11
+    <div>
  12
+        <asp:Label ID="ClientIP" runat="server" Text="IP Address Unknown"></asp:Label>
  13
+    </div>
  14
+    </form>
  15
+</body>
  16
+</html>
18  myIP/Default.aspx.cs
... ...
@@ -0,0 +1,18 @@
  1
+using System;
  2
+using System.Net;
  3
+using System.Text;
  4
+
  5
+namespace myIP {
  6
+    public partial class Default : System.Web.UI.Page {
  7
+        protected void Page_Load(object sender, EventArgs e) {
  8
+            ClientIP.Text = GetExternalIp();
  9
+        }
  10
+        private string GetExternalIp() {
  11
+            string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
  12
+            if (String.IsNullOrEmpty(ip)) {
  13
+                ip = Request.ServerVariables["REMOTE_ADDR"];
  14
+            }
  15
+            return ip;
  16
+        }
  17
+    }
  18
+}
33  myIP/Default.aspx.designer.cs
... ...
@@ -0,0 +1,33 @@
  1
+//------------------------------------------------------------------------------
  2
+// <auto-generated>
  3
+//     This code was generated by a tool.
  4
+//
  5
+//     Changes to this file may cause incorrect behavior and will be lost if
  6
+//     the code is regenerated. 
  7
+// </auto-generated>
  8
+//------------------------------------------------------------------------------
  9
+
  10
+namespace myIP {
  11
+    
  12
+    
  13
+    public partial class Default {
  14
+        
  15
+        /// <summary>
  16
+        /// form1 control.
  17
+        /// </summary>
  18
+        /// <remarks>
  19
+        /// Auto-generated field.
  20
+        /// To modify move field declaration from designer file to code-behind file.
  21
+        /// </remarks>
  22
+        protected global::System.Web.UI.HtmlControls.HtmlForm form1;
  23
+        
  24
+        /// <summary>
  25
+        /// ClientIP control.
  26
+        /// </summary>
  27
+        /// <remarks>
  28
+        /// Auto-generated field.
  29
+        /// To modify move field declaration from designer file to code-behind file.
  30
+        /// </remarks>
  31
+        protected global::System.Web.UI.WebControls.Label ClientIP;
  32
+    }
  33
+}
35  myIP/Properties/AssemblyInfo.cs
... ...
@@ -0,0 +1,35 @@
  1
+using System.Reflection;
  2
+using System.Runtime.CompilerServices;
  3
+using System.Runtime.InteropServices;
  4
+
  5
+// General Information about an assembly is controlled through the following 
  6
+// set of attributes. Change these attribute values to modify the information
  7
+// associated with an assembly.
  8
+[assembly: AssemblyTitle("myIP")]
  9
+[assembly: AssemblyDescription("")]
  10
+[assembly: AssemblyConfiguration("")]
  11
+[assembly: AssemblyCompany("Microsoft")]
  12
+[assembly: AssemblyProduct("myIP")]
  13
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
  14
+[assembly: AssemblyTrademark("")]
  15
+[assembly: AssemblyCulture("")]
  16
+
  17
+// Setting ComVisible to false makes the types in this assembly not visible 
  18
+// to COM components.  If you need to access a type in this assembly from 
  19
+// COM, set the ComVisible attribute to true on that type.
  20
+[assembly: ComVisible(false)]
  21
+
  22
+// The following GUID is for the ID of the typelib if this project is exposed to COM
  23
+[assembly: Guid("2e10925f-bc88-4334-8cf5-954ce7622624")]
  24
+
  25
+// Version information for an assembly consists of the following four values:
  26
+//
  27
+//      Major Version
  28
+//      Minor Version 
  29
+//      Build Number
  30
+//      Revision
  31
+//
  32
+// You can specify all the values or you can default the Revision and Build Numbers 
  33
+// by using the '*' as shown below:
  34
+[assembly: AssemblyVersion("1.0.0.0")]
  35
+[assembly: AssemblyFileVersion("1.0.0.0")]
30  myIP/Web.Debug.config
... ...
@@ -0,0 +1,30 @@
  1
+<?xml version="1.0"?>
  2
+
  3
+<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
  4
+
  5
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  6
+  <!--
  7
+    In the example below, the "SetAttributes" transform will change the value of 
  8
+    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
  9
+    finds an atrribute "name" that has a value of "MyDB".
  10
+    
  11
+    <connectionStrings>
  12
+      <add name="MyDB" 
  13
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
  14
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
  15
+    </connectionStrings>
  16
+  -->
  17
+  <system.web>
  18
+    <!--
  19
+      In the example below, the "Replace" transform will replace the entire 
  20
+      <customErrors> section of your web.config file.
  21
+      Note that because there is only one customErrors section under the 
  22
+      <system.web> node, there is no need to use the "xdt:Locator" attribute.
  23
+      
  24
+      <customErrors defaultRedirect="GenericError.htm"
  25
+        mode="RemoteOnly" xdt:Transform="Replace">
  26
+        <error statusCode="500" redirect="InternalError.htm"/>
  27
+      </customErrors>
  28
+    -->
  29
+  </system.web>
  30
+</configuration>
31  myIP/Web.Release.config
... ...
@@ -0,0 +1,31 @@
  1
+<?xml version="1.0"?>
  2
+
  3
+<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
  4
+
  5
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  6
+  <!--
  7
+    In the example below, the "SetAttributes" transform will change the value of 
  8
+    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
  9
+    finds an atrribute "name" that has a value of "MyDB".
  10
+    
  11
+    <connectionStrings>
  12
+      <add name="MyDB" 
  13
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
  14
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
  15
+    </connectionStrings>
  16
+  -->
  17
+  <system.web>
  18
+    <compilation xdt:Transform="RemoveAttributes(debug)" />
  19
+    <!--
  20
+      In the example below, the "Replace" transform will replace the entire 
  21
+      <customErrors> section of your web.config file.
  22
+      Note that because there is only one customErrors section under the 
  23
+      <system.web> node, there is no need to use the "xdt:Locator" attribute.
  24
+      
  25
+      <customErrors defaultRedirect="GenericError.htm"
  26
+        mode="RemoteOnly" xdt:Transform="Replace">
  27
+        <error statusCode="500" redirect="InternalError.htm"/>
  28
+      </customErrors>
  29
+    -->
  30
+  </system.web>
  31
+</configuration>
13  myIP/Web.config
... ...
@@ -0,0 +1,13 @@
  1
+<?xml version="1.0"?>
  2
+
  3
+<!--
  4
+  For more information on how to configure your ASP.NET application, please visit
  5
+  http://go.microsoft.com/fwlink/?LinkId=169433
  6
+  -->
  7
+
  8
+<configuration>
  9
+    <system.web>
  10
+        <compilation debug="true" targetFramework="4.0" />
  11
+    </system.web>
  12
+
  13
+</configuration>
100  myIP/myIP.csproj
... ...
@@ -0,0 +1,100 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3
+  <PropertyGroup>
  4
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  5
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  6
+    <ProductVersion>
  7
+    </ProductVersion>
  8
+    <SchemaVersion>2.0</SchemaVersion>
  9
+    <ProjectGuid>{1A90B7E7-E55A-403F-A800-3615B97EAA66}</ProjectGuid>
  10
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
  11
+    <OutputType>Library</OutputType>
  12
+    <AppDesignerFolder>Properties</AppDesignerFolder>
  13
+    <RootNamespace>myIP</RootNamespace>
  14
+    <AssemblyName>myIP</AssemblyName>
  15
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  16
+  </PropertyGroup>
  17
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  18
+    <DebugSymbols>true</DebugSymbols>
  19
+    <DebugType>full</DebugType>
  20
+    <Optimize>false</Optimize>
  21
+    <OutputPath>bin\</OutputPath>
  22
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
  23
+    <ErrorReport>prompt</ErrorReport>
  24
+    <WarningLevel>4</WarningLevel>
  25
+  </PropertyGroup>
  26
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  27
+    <DebugType>pdbonly</DebugType>
  28
+    <Optimize>true</Optimize>
  29
+    <OutputPath>bin\</OutputPath>
  30
+    <DefineConstants>TRACE</DefineConstants>
  31
+    <ErrorReport>prompt</ErrorReport>
  32
+    <WarningLevel>4</WarningLevel>
  33
+  </PropertyGroup>
  34
+  <ItemGroup>
  35
+    <Reference Include="Microsoft.CSharp" />
  36
+    <Reference Include="System.Web.DynamicData" />
  37
+    <Reference Include="System.Web.Entity" />
  38
+    <Reference Include="System.Web.ApplicationServices" />
  39
+    <Reference Include="System" />
  40
+    <Reference Include="System.Data" />
  41
+    <Reference Include="System.Core" />
  42
+    <Reference Include="System.Data.DataSetExtensions" />
  43
+    <Reference Include="System.Web.Extensions" />
  44
+    <Reference Include="System.Xml.Linq" />
  45
+    <Reference Include="System.Drawing" />
  46
+    <Reference Include="System.Web" />
  47
+    <Reference Include="System.Xml" />
  48
+    <Reference Include="System.Configuration" />
  49
+    <Reference Include="System.Web.Services" />
  50
+    <Reference Include="System.EnterpriseServices" />
  51
+  </ItemGroup>
  52
+  <ItemGroup>
  53
+    <Content Include="Default.aspx" />
  54
+    <Content Include="Web.config" />
  55
+    <Content Include="Web.Debug.config">
  56
+      <DependentUpon>Web.config</DependentUpon>
  57
+    </Content>
  58
+    <Content Include="Web.Release.config">
  59
+      <DependentUpon>Web.config</DependentUpon>
  60
+    </Content>
  61
+  </ItemGroup>
  62
+  <ItemGroup>
  63
+    <Compile Include="Default.aspx.cs">
  64
+      <DependentUpon>Default.aspx</DependentUpon>
  65
+      <SubType>ASPXCodeBehind</SubType>
  66
+    </Compile>
  67
+    <Compile Include="Default.aspx.designer.cs">
  68
+      <DependentUpon>Default.aspx</DependentUpon>
  69
+    </Compile>
  70
+    <Compile Include="Properties\AssemblyInfo.cs" />
  71
+  </ItemGroup>
  72
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  73
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
  74
+  <ProjectExtensions>
  75
+    <VisualStudio>
  76
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
  77
+        <WebProjectProperties>
  78
+          <UseIIS>False</UseIIS>
  79
+          <AutoAssignPort>True</AutoAssignPort>
  80
+          <DevelopmentServerPort>2025</DevelopmentServerPort>
  81
+          <DevelopmentServerVPath>/</DevelopmentServerVPath>
  82
+          <IISUrl>
  83
+          </IISUrl>
  84
+          <NTLMAuthentication>False</NTLMAuthentication>
  85
+          <UseCustomServer>False</UseCustomServer>
  86
+          <CustomServerUrl>
  87
+          </CustomServerUrl>
  88
+          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
  89
+        </WebProjectProperties>
  90
+      </FlavorProperties>
  91
+    </VisualStudio>
  92
+  </ProjectExtensions>
  93
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
  94
+       Other similar extension points exist, see Microsoft.Common.targets.
  95
+  <Target Name="BeforeBuild">
  96
+  </Target>
  97
+  <Target Name="AfterBuild">
  98
+  </Target>
  99
+  -->
  100
+</Project>
14  readme.md
Source Rendered
... ...
@@ -0,0 +1,14 @@
  1
+myIP
  2
+==========
  3
+
  4
+just goofing off with ASP .NET and HttpContext.Current.Request.ServerVariables
  5
+
  6
+Usage
  7
+-----
  8
+
  9
+Navigate to the page and your IP address will be displayed.
  10
+
  11
+Copyright
  12
+---------
  13
+
  14
+Copyright (c) 2011 <a href="http://creatingcode.com">Robert Greiner</a>. See LICENSE for details.

0 notes on commit 99dd114

Please sign in to comment.
Something went wrong with that request. Please try again.