Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: [VBNet/C#] HotmailFunctions

  1. #1
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m

    [VBNet/C#] HotmailFunctions

    VBNet:
    Code:
    Option Strict On
    Imports System.Net
    Imports System.Text.RegularExpressions
    
    Public Class HotmailFunctions
        Public Shared EmailPattern As Regex = New Regex("^[A-Z0-9._%+-]+@(?:live|msn|hotmail)\.com$", RegexOptions.IgnoreCase)
        Public Shared Function HotmailExists(ByVal Email As String) As Boolean
            If Not HotmailFunctions.IsValid(Email) Then
                Return False
            End If
            Dim request As HttpWebRequest =
                DirectCast(WebRequest.Create("https://accountservices.passport.net/pp1300/memberexists.srf"), HttpWebRequest)
            request.Headers.Add("Cookie: MSPMemberExists=" & Email)
            Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
            If response IsNot Nothing Then response.Close()
            Return response.GetResponseHeader("Set-Cookie").ToLower().Contains("mspmemberexists=memberexists")
        End Function
        Public Shared Function IsValid(ByVal Email As String) As Boolean
            Return HotmailFunctions.EmailPattern.IsMatch(Email)
        End Function
    End Class
    C#:
    Code:
    using System.Net;
    using System.Text.RegularExpressions;
    
    class HotmailFunctions
    {
        public static Regex EmailPattern = new Regex(@"^[A-Z0-9._%+-]+@(?:live|msn|hotmail)\.com$", RegexOptions.IgnoreCase);
        public static bool HotmailExists(string email)
        {
            if (!HotmailFunctions.IsValid(email))
                return false;
            HttpWebRequest request =
                (HttpWebRequest)WebRequest.Create("https://accountservices.passport.net/pp1300/memberexists.srf");
            request.Headers.Add("Cookie: MSPMemberExists=" + email);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            if (response != null)
                response.Close();
            return response.GetResponseHeader("Set-Cookie")
                    .ToLower().Contains("mspmemberexists=memberexists");
        }
        public static bool IsValid(string email)
        {
            return HotmailFunctions.EmailPattern.IsMatch(email);
        }
    }
    Last edited by Zachafer; 04-07-2012 at 03:30 PM.

  2. The Following 2 Users Say Thank You to Zachafer For This Useful Post:

    DarkByte (06-26-2012),deathwish42 (06-26-2012)

  3. #2

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    Nice Regex work

  4. #3
    deathwish42's Avatar
    Joined
    Jun 2012
    Posts
    388
    Userbars
    2
    Thanks
    46
    Thanked
    45/39
    DL/UL
    50/0
    Mentioned
    45 times
    Time Online
    21d 6h 5m
    Avg. Time Online
    7m
    whats that do?

  5. #4
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    The Regex in here just weeds out the invalid formats, example:
    It's nothing special, the highlight of this snippet is the HTTPWebRequest used to check if the Hotmail exists

  6. #5
    deathwish42's Avatar
    Joined
    Jun 2012
    Posts
    388
    Userbars
    2
    Thanks
    46
    Thanked
    45/39
    DL/UL
    50/0
    Mentioned
    45 times
    Time Online
    21d 6h 5m
    Avg. Time Online
    7m
    oh very cool hows your altador cup completer coming?

  7. #6
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Quote Originally Posted by deathwish42 View Post
    oh very cool hows your altador cup completer coming?
    Should be done shortly. I have finished step 10/14:

  8. #7

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    What about hotmail.co.uk addresses (and other domains) would these still work?

  9. #8
    deathwish42's Avatar
    Joined
    Jun 2012
    Posts
    388
    Userbars
    2
    Thanks
    46
    Thanked
    45/39
    DL/UL
    50/0
    Mentioned
    45 times
    Time Online
    21d 6h 5m
    Avg. Time Online
    7m
    wow i like that altador plot completer how long does it take normally for each part of the plot?

  10. #9
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Quote Originally Posted by raredaredevil View Post
    What about hotmail.co.uk addresses (and other domains) would these still work?
    You would have to change the Regex pattern, but they are checked the same way (passport.net)

  11. #10
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,720
    Userbars
    166
    Thanks
    5,906
    Thanked
    33,076/6,608
    DL/UL
    23/36
    Mentioned
    3,867 times
    Time Online
    563d 4h 55m
    Avg. Time Online
    3h 14m
    Quote Originally Posted by Zachafer View Post
    Should be done shortly. I have finished step 10/14:
    Funny how I gave you the first 9 or 10 solutions and asked you to fix the rest.
    (you need an account to see links)
    (you need an account to see links)(you need an account to see links)

    ------------------------
    [02/24/2013] Stealth CORE is made into the first standalone Neopets auto-player.
    ------------------------


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •