Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
ASP.NET
ASP.NET General Discussion
Routing table
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="JuggaloBrotha, post: 181046, member: 13"] If you're stuck on getting the client's IP address here's this:[xcode=vb.net]Imports System Imports System.Web Module IP Function GetIPAddress() As String Return GetIPAddress(New HttpRequestWrapper(HttpContext.Current.Request)) End Function Friend Function GetIPAddress(ByVal request As HttpRequestBase) As String Dim forwarded As String = request.Headers("Forwarded") If Not String.IsNullOrEmpty(forwarded) Then For Each segment As String In forwarded.Split(","c)(0).Split(";"c) Dim pair As String() = segment.Trim().Split("="c) If pair.Length = 2 AndAlso pair(0).Equals("for", StringComparison.OrdinalIgnoreCase) Then Dim ip As String = pair(1).Trim(""""c) Dim left As Integer = ip.IndexOf("["c), right As Integer = ip.IndexOf("]"c) If left = 0 AndAlso right > 0 Then Return ip.Substring(1, right - 1) End If Dim colon As Integer = ip.IndexOf(":"c) If colon <> -1 Then Return ip.Substring(0, colon) End If Return ip End If Next End If Dim xForwardedFor As String = request.Headers("X-Forwarded-For") If Not String.IsNullOrEmpty(xForwardedFor) Then Return xForwardedFor.Split(","c)(0) End If Return request.UserHostAddress End Function End Module[/xcode]Just add it to your project as a new class and call it:[xcode=vb.net]IP.GetIPAddress()[/xcode]As for the push notifications that's something I haven't had a need to learn how to do yet. [/QUOTE]
Insert quotes…
Verification
Post reply
ASP.NET
ASP.NET General Discussion
Routing table
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom