PDA

View Full Version : [VBNet/C#] HotmailFunctions



Zachafer
04-07-2012, 03:09 PM
VBNet:
Option Strict On
Imports System.Net
Imports System.Text.RegularExpressions

Public Class HotmailFunctions
[Only registered and activated users can see links]
Public Shared Function HotmailExists(ByVal Email As String) As Boolean
If Not HotmailFunctions.IsValid(Email) Then
Return False
End If
Dim request As [Only registered and activated users can see links] =
DirectCast(WebRequest.Create("[Only registered and activated users can see links]"), [Only registered and activated users can see links])
request.Headers.Add("Cookie: MSPMemberExists=" & Email)
Dim response As [Only registered and activated users can see links] = DirectCast(request.GetResponse(), [Only registered and activated users can see links])
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#:
using System.Net;
using System.Text.RegularExpressions;

class HotmailFunctions
{
[Only registered and activated users can see links]
public static bool HotmailExists(string email)
{
if (!HotmailFunctions.IsValid(email))
return false;
[Only registered and activated users can see links] request =
([Only registered and activated users can see links])WebRequest.Create("[Only registered and activated users can see links]");
request.Headers.Add("Cookie: MSPMemberExists=" + email);
[Only registered and activated users can see links] response = ([Only registered and activated users can see links])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);
}
}

DarkByte
06-26-2012, 07:54 PM
Nice Regex work :)

deathwish42
06-26-2012, 07:55 PM
whats that do?

Zachafer
06-26-2012, 07:57 PM
The Regex in here just weeds out the invalid formats, example:

[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]

It's nothing special, the highlight of this snippet is the [Only registered and activated users can see links] used to check if the Hotmail exists

deathwish42
06-26-2012, 07:58 PM
oh very cool hows your altador cup completer coming?

Zachafer
06-26-2012, 08:00 PM
oh very cool hows your altador cup completer coming?

Should be done shortly. I have finished step 10/14:
[Only registered and activated users can see links]

DarkByte
06-26-2012, 08:01 PM
What about hotmail.co.uk addresses (and other domains) would these still work?

deathwish42
06-26-2012, 08:04 PM
wow i like that altador plot completer how long does it take normally for each part of the plot?

Zachafer
06-26-2012, 08:06 PM
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)

j03
06-26-2012, 11:54 PM
Should be done shortly. I have finished step 10/14:
[Only registered and activated users can see links]

Funny how I gave you the first 9 or 10 solutions and asked you to fix the rest. :P

Zachafer
06-26-2012, 11:58 PM
Funny how I gave you the first 9 or 10 solutions and asked you to fix the rest. :P

Are you accusing me of ripping your code? or is this just really bad humor?

j03
06-27-2012, 12:08 AM
You find it bad humor?? :watermelon: