Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (0)

I should just replicate Scott's Blog. This is the best article to implemented. I need to implemented soon, so this is a reminder for myself, please read it before trying it ;-)

http://weblogs.asp.net/scottgu/archive/2006/07/12/Recipe_3A00_-Enabling-Windows-Authentication-within-an-Intranet-ASP.NET-Web-application.aspx

And Roles and Security:

http://weblogs.asp.net/scottgu/archive/2006/07/18/Remote-Membership_2F00_Roles-Management-of-ASP.NET-2.0-Applications.aspx

Scott rocks!

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (0)

Well, so you want to load balanced a website but you don't have the hardware as you are hosting the site in a hoster. Well if you don't mind to use www1.domain.com, www2.domain.com etc, this is the solution. You can download the control that does it here:

http://alpascual.com/blog/al/archive/2006/05/26/179.aspx

This is at 20,000 feet how it works:

public class LoadBalancerRun

{

private System.Web.HttpContext m_oContext = null;

public LoadBalancerRun(System.Web.HttpContext oContext)

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

public LoadBalancerRun(System.Web.HttpContext oContext)

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

private System.Web.HttpContext m_oContext = null;

public LoadBalancerRun(System.Web.HttpContext oContext)

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

public LoadBalancerRun(System.Web.HttpContext oContext)

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

class LoadBalancerRun

{

private System.Web.HttpContext m_oContext = null;

public LoadBalancerRun(System.Web.HttpContext oContext)

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

public LoadBalancerRun(System.Web.HttpContext oContext)

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

private System.Web.HttpContext m_oContext = null;

public LoadBalancerRun(System.Web.HttpContext oContext)

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

public LoadBalancerRun(System.Web.HttpContext oContext)

{

m_oContext = oContext;

}

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

public void Run(string sFilename)

{

LoadXmlReader oConfig = null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

null;

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

if (sFilename.Length > 0)

oConfig = new LoadXmlReader(m_oContext,sFilename);

else

else

new LoadXmlReader(m_oContext,sFilename);

else

else

oConfig = new LoadXmlReader(m_oContext);

TestIsServerAlive oAlive = new TestIsServerAlive();

LogFile oLog = new LogFile();

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

LogFile oLog = new LogFile();

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

TestIsServerAlive oAlive = new TestIsServerAlive();

LogFile oLog = new LogFile();

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

LogFile oLog = new LogFile();

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

new LoadXmlReader(m_oContext);

TestIsServerAlive oAlive = new TestIsServerAlive();

LogFile oLog = new LogFile();

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

LogFile oLog = new LogFile();

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

new TestIsServerAlive();

LogFile oLog = new LogFile();

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

new LogFile();

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

bool bAlive = false;

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

string sNext = "";

 

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

{

// Get next server to redirect

for(int i=0; i<oConfig.GetAll().Count; i++)

{

// Get next server to redirect

// Get next server to redirect

sNext = oConfig.GetNext();

 

// Test server to redirect

// Test server to redirect

bAlive = oAlive.IsAlive(sNext);

if ( bAlive == true )

break;

}

oLog.Add(m_oContext.Request.UserHostAddress, m_oContext.Session.SessionID, sNext, bAlive);

if (bAlive == false)

m_oContext.Response.Write("All servers down!");

else

else

m_oContext.Response.Write("All servers down!");

else

else

}

oLog.Add(m_oContext.Request.UserHostAddress, m_oContext.Session.SessionID, sNext, bAlive);

if (bAlive == false)

m_oContext.Response.Write("All servers down!");

else

else

m_oContext.Response.Write("All servers down!");

else

else

break;

}

oLog.Add(m_oContext.Request.UserHostAddress, m_oContext.Session.SessionID, sNext, bAlive);

if (bAlive == false)

m_oContext.Response.Write("All servers down!");

else

else

m_oContext.Response.Write("All servers down!");

else

else

}

oLog.Add(m_oContext.Request.UserHostAddress, m_oContext.Session.SessionID, sNext, bAlive);

if (bAlive == false)

m_oContext.Response.Write("All servers down!");

else

else

m_oContext.Response.Write("All servers down!");

else

else

if ( bAlive == true )

break;

}

oLog.Add(m_oContext.Request.UserHostAddress, m_oContext.Session.SessionID, sNext, bAlive);

if (bAlive == false)

m_oContext.Response.Write("All servers down!");

else

else

m_oContext.Response.Write("All servers down!");

else

else

}

oLog.Add(m_oContext.Request.UserHostAddress, m_oContext.Session.SessionID, sNext, bAlive);

if (bAlive == false)

m_oContext.Response.Write("All servers down!");

else

else

m_oContext.Response.Write("All servers down!");

else

else

break;

}

oLog.Add(m_oContext.Request.UserHostAddress, m_oContext.Session.SessionID, sNext, bAlive);

if (bAlive == false)

m_oContext.Response.Write("All servers down!");

else

else

m_oContext.Response.Write("All servers down!");

else

else

if (bAlive == false)

m_oContext.Response.Write("All servers down!");

else

else

"All servers down!");

else

else

m_oContext.Response.Redirect(sNext);

 

}

}

The steps are the following, you read the XML file, test the server and redirect them to the next domain. Make sure you DNS the domains per alias. Any problem using the control I'll be happy to help or modify.

Cheers

Al

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (1)

Atlast June 2006 has a bug when adding a suggestion extender inside a UpdatePanel, the page does not refresh. The list of all improvement may be found here:

http://forums.asp.net/thread/1349122.aspx

To reproduct it:

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Always">

<ContentTemplate>

<table id="Table1" style="width: 375px">

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<table id="Table1" style="width: 375px">

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<ContentTemplate>

<table id="Table1" style="width: 375px">

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<table id="Table1" style="width: 375px">

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Always">

<ContentTemplate>

<table id="Table1" style="width: 375px">

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<table id="Table1" style="width: 375px">

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

ContentTemplate>

<table id="Table1" style="width: 375px">

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

table id="Table1" style="width: 375px">

<tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

tr>

<td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

td style="width: 400px">

<asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

asp:TextBox ID="TextBox1Atlas" AutoPostBack="true" runat="server" MaxLength="5" Width="75px" OnTextChanged="TextBox1Atlas_TextChanged" ></asp:TextBox>

<asp:Label ID="Label1" runat="server" Text=""></asp:Label></td>

</tr>

</table>

</ContentTemplate>

</ContentTemplate>

</table>

</ContentTemplate>

</ContentTemplate>

</tr>

</table>

</ContentTemplate>

</ContentTemplate>

</table>

</ContentTemplate>

</ContentTemplate>

<asp:Label ID="Label1" runat="server" Text=""></asp:Label></td>

</tr>

</table>

</ContentTemplate>

</ContentTemplate>

</table>

</ContentTemplate>

</ContentTemplate>

tr>

</table>

</ContentTemplate>

</ContentTemplate>

table>

</ContentTemplate>

ContentTemplate>

</atlas:UpdatePanel>

</atlas:UpdatePanel>

<atlas:AutoCompleteExtender ID="AutoCompleteExtender1" ServicePath="Atlas.asmx" ServiceMethod="GetSuggestions" MinimumPrefixLength="1" runat="server">

atlas:AutoCompleteExtender ID="AutoCompleteExtender1" ServicePath="Atlas.asmx" ServiceMethod="GetSuggestions" MinimumPrefixLength="1" runat="server">

<atlas:AutoCompleteProperties TargetControlID="TextBox1Atlas" Enabled="true" />

</atlas:AutoCompleteExtender>

</atlas:AutoCompleteExtender>

<atlas:AutoCompleteProperties TargetControlID="TextBox1Atlas" Enabled="true" />

</atlas:AutoCompleteExtender>

atlas:AutoCompleteExtender>

If anybody knows a way around that problem, please leave a comment or send me an email.

Cheers

Al

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (0)

Most ASP.NET and Windows Forms applications are required to send emails. Many people also use email to send errors. Microsoft providers the System.Net.Mail namespace to do that job, they have improved the email SmtpClient since version 1.1. However sending thousands of emails can become a very long task to keep track.

 

I develop a component that you can download called FreeMail http://alpascual.com/control/bettermailmessage.htm

 

I wanted to talk about the magic behind the control. The main class deriving from SmtpClient looks like this:

 

public class FreeMail : SmtpClient

    {

        private ArrayList m_aMailServers = null;

       

        // New Queue

        public delegate void SendAllNewQueueDelegate();

        public event SendAllNewQueueDelegate SendAllNew;

 

        public delegate void SendAllPendingQueueDelegate();

        public event SendAllPendingQueueDelegate SendAllPending;

                

        public int MaxHoursToRetry = 24;

 

        public FreeMail(ArrayList aMailServers)

        {

            // Resolve the all mail servers

            m_aMailServers = new ArrayList();

            for(int i=0; i<aMailServers.Count; i++)

            {

                IPHostEntry local = Dns.Resolve(aMailServers[i].ToString());

               

                foreach (IPAddress ipaddress in local.AddressList)

                {

                    m_aMailServers.Add(ipaddress.ToString());

                }

            }

 

            SendAllNew += new SendAllNewQueueDelegate(FreeMail_SendAllNew);

            SendAllPending += new SendAllPendingQueueDelegate(FreeMail_SendAllPending);

        }

 

        void FreeMail_SendAllPending()

        {

            for (int i = 0; i < PendingQueue.Count; i++)

            {

                BetterMailMessage oMessage = PendingQueue.Dequeue();

                if (DoSend(oMessage) == false)

                {

                    if (oMessage.Date.AddHours(MaxHoursToRetry) >= DateTime.Now)

                        PendingQueue.Add(oMessage);

                    else

                        BetterMessageError.Add(oMessage);

                }

            }

        }

 

        void FreeMail_SendAllNew()

        {

            for (int i = 0; i < NewQueue.Count; i++)

            {

                BetterMailMessage oMessage = NewQueue.Dequeue();

                if (DoSend(oMessage) == false)

                    PendingQueue.Add(oMessage);

            }

        }

 

        private new void Send(MailMessage oMessage)

        {

 

            base.Send(oMessage);

        }

 

        public void Send(BetterMailMessage oMessage)

        {           

            NewQueue.Add(oMessage);

 

            this.SendAllNew();

            this.SendAllPending();

        }

 

        private bool DoSend(BetterMailMessage oMessage)

        {

            bool bSucess = false;

 

            if (LoadBalancing == true)

                m_aMailServers.Reverse();

 

            for (int i = 0; i < m_aMailServers.Count; i++)

            {

                base.Host = m_aMailServers[i].ToString();

                try

                {

                    MailMessage oMessageBase = oMessage;

                    if (TrackingUrl.Length > 1)

                        oMessageBase.Body += BetterTracker.Track(TrackingUrl, oMessageBase.To);

 

                        base.Send(oMessageBase);

                    bSucess = true;

                }

                catch { bSucess = false; }

 

                if (bSucess == true)

                    break;

            }

 

            return (bSucess);

        }

 

        private bool bLoadBalancing = false;

        public bool LoadBalancing

        {

            get { return (bLoadBalancing); }

            set { bLoadBalancing = value;  }

        }

 

        private string sTrackingUrl = "";

        public string TrackingUrl

        {

            get { return (sTrackingUrl); }

            set { sTrackingUrl = value; }

        }

    }

 

Lets go step by step, the constructor resolves all mail servers to their IP address, the Send function will send all new email and old old queued, you’ll be able to track the email by adding a TrackingUrl property that will be called back when the user opens the email and does not block images.

 

How do we track the email? This is the class to track them, not guarantied that will work for all email readers of course:

 

public class BetterTracker

    {

        public static string Track(string sUrl, MailAddressCollection sTo)

        {

            string sRet = "<IMG height=1 src=\"" + sUrl + "?Tracking=" + Encoding(sTo) + "\" width=1>";

 

            return (sRet);

        }

 

        public static string Encoding(MailAddressCollection sTo)

        {

            string sAllTo = "";

            for (int i = 0; i < sTo.Count; i++)

            {

                sAllTo += sTo[i].Address + " ";

            }

 

            string uidpwd = sAllTo + ":" + DateTime.Now.ToString();

 

            string sEn = AlEncrypt.Encrypt(uidpwd);

            return (HttpUtility.UrlEncode(sEn));

 

        }

 

        public static TrackDetails Decode(string EncodedString)

        {

            string sDe = HttpUtility.UrlDecode(EncodedString);

 

            string sBeforeClass = AlEncrypt.Decrypt(sDe);

 

            TrackDetails oDetails = new TrackDetails();

 

            try

            {

                int len = sBeforeClass.IndexOf(":");

                string sTo = sBeforeClass.Substring(0, len);

                string sTime = sBeforeClass.Substring(len + 1);

                DateTime dtTime = Convert.ToDateTime(sTime);

 

                oDetails.sTo = sTo;

                oDetails.TimeSent = dtTime;

            }

            catch { }

 

            return (oDetails);

        }

    }

 

    public class TrackDetails

    {

        public string sTo = "";

        public DateTime TimeSent;

    }

 

    public class AlEncrypt

    {

        private static string sKey = "al%&is($awesome^ohyes$!too*whois)better**than(Albert!";

        public static string Encrypt(string sPainText)

        {

            if (sPainText.Length == 0)

                return (sPainText);

 

            return (EncryptString(sPainText, sKey));

        }

 

        public static string Decrypt(string sEncryptText)

        {

            if (sEncryptText.Length == 0)

                return (sEncryptText);

 

            return (DecryptString(sEncryptText, sKey));

        }

 

        protected static string EncryptString(string InputText, string Password)

        {

            // "Password" string variable is nothing but the key(your secret key) value which is sent from the front end.

            // "InputText" string variable is the actual password sent from the login page.

 

            // We are now going to create an instance of the

            // Rihndael class. 

            RijndaelManaged RijndaelCipher = new RijndaelManaged();

 

            // First we need to turn the input strings into a byte array.

            byte[] PlainText = System.Text.Encoding.Unicode.GetBytes(InputText);

 

            // We are using Salt to make it harder to guess our key

            // using a dictionary attack.

            byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString());

 

            // The (Secret Key) will be generated from the specified

            // password and Salt.

 

            //PasswordDeriveBytes -- It Derives a key from a password

            PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);

 

            // Create a encryptor from the existing SecretKey bytes.

            // We use 32 bytes for the secret key

            // (the default Rijndael key length is 256 bit = 32 bytes) and

            // then 16 bytes for the IV (initialization vector),

            // (the default Rijndael IV length is 128 bit = 16 bytes)

 

            ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecretKey.GetBytes(16), SecretKey.GetBytes(16));

 

            // Create a MemoryStream that is going to hold the encrypted bytes

            MemoryStream memoryStream = new MemoryStream();

 

            // Create a CryptoStream through which we are going to be processing our data.

            // CryptoStreamMode.Write means that we are going to be writing data

            // to the stream and the output will be written in the MemoryStream

            // we have provided. (always use write mode for encryption)

            CryptoStream cryptoStream = new CryptoStream(memoryStream, Encryptor, CryptoStreamMode.Write);

 

            // Start the encryption process.

            cryptoStream.Write(PlainText, 0, PlainText.Length);

 

            // Finish encrypting.

            cryptoStream.FlushFinalBlock();

 

            // Convert our encrypted data from a memoryStream into a byte array.

            byte[] CipherBytes = memoryStream.ToArray();

 

            // Close both streams.

            memoryStream.Close();

            cryptoStream.Close();

 

            // Convert encrypted data into a base64-encoded string.

            // A common mistake would be to use an Encoding class for that.

            // It does not work, because not all byte values can be

            // represented by characters. We are going to be using Base64 encoding

            // That is designed exactly for what we are trying to do.

            string EncryptedData = Convert.ToBase64String(CipherBytes);

 

            // Return encrypted string.

            return EncryptedData;

        }

 

 

        protected static string DecryptString(string InputText, string Password)

        {

            RijndaelManaged RijndaelCipher = new RijndaelManaged();

 

            byte[] EncryptedData = Convert.FromBase64String(InputText);

            byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString());

 

            PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);

 

            // Create a decryptor from the existing SecretKey bytes.

            ICryptoTransform Decryptor = RijndaelCipher.CreateDecryptor(SecretKey.GetBytes(16), SecretKey.GetBytes(16));

 

            MemoryStream memoryStream = new MemoryStream(EncryptedData);

 

            // Create a CryptoStream. (always use Read mode for decryption).

            CryptoStream cryptoStream = new CryptoStream(memoryStream, Decryptor, CryptoStreamMode.Read);

 

            // Since at this point we don't know what the size of decrypted data

            // will be, allocate the buffer long enough to hold EncryptedData;

            // DecryptedData is never longer than EncryptedData.

            byte[] PlainText = new byte[EncryptedData.Length];

 

            // Start decrypting.

            int DecryptedCount = cryptoStream.Read(PlainText, 0, PlainText.Length);

 

            memoryStream.Close();

            cryptoStream.Close();

 

            // Convert decrypted data into a string.

            string DecryptedData = Encoding.Unicode.GetString(PlainText, 0, DecryptedCount);

 

            // Return decrypted string.  

            return DecryptedData;

        }

 

 

    }

 

Also we have the class to queue the emails when they failed, but that’s a normal queue. If you want me to show you how it works, please let me know.

 

Hope this helps with that component.

 

Cheers

Al

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (0)

When adding an UpdatePanel inside a GridView or FormView you get the error that UpdatePanel cannot be placed inside a tempate.New Atlas release fixes the most annoying bug of all:

 

The UpdatePanel 'UpdatePanel1' was not present when the page's InitComplete event was raised. This is usually caused when an UpdatePanel is placed inside a template

 

Download ASP.NET “Atlas” June 2006 Community Technology Preview (CTP)

from here: http://www.microsoft.com/downloads/details.aspx?FamilyId=81BF1390-7894-4FF7-B591-1006BD770BC0&displaylang=en

 

I have not find any problem yet with this new release. There are many notes and helpful tips on http://atlas.asp.net as well and as always you can check Scott’s blog for any news about this fantastic library. http://weblogs.asp.net/scottgu/archive/2006/06/19/More-Atlas-Resources-_2800_Videos_2C00_-Articles_2C00_-WebCasts-and-Books_2900_.aspx

 

Best part, I can create my own controls: http://atlas.asp.net/atlastoolkit/Walkthrough/CreatingNewExtender.aspx

 

Cheers

Al

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (0)

This is the best tutorial for creating a database Layer DAL in Visual Studio 2005:

http://www.asp.net/learn/dataaccess/tutorial02cs.aspx?tabid=63

Shows you how to implement and use partial classes to create you own objects. Scott Michell is a great author.

After dragging and dropping the fields that you need, Visual Studio 2005 will create the public methods to DELETE, INSERT AND UPDATE.

Adding new queries is easy by using the UI. Each query will be created as a public method of the Adapter class. You can also use Transactions class if you need to queue many of them. If any of them failed, the system will roll them back.

This is the solution to complete Database Layer that everybody has been looking forward.

Cheers

Al

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (4)

Once again after a year I found code for a windows service using System.Timers.Timer, and guess what, it does not work ... again ... duh. So after all these resources telling you, don't do it:

http://discuss.develop.com/archives/wa.exe?A2=ind0306D&L=DOTNET-CLR&P=R1007&D=0&I=-3

http://discuss.develop.com/archives/wa.exe?A2=ind0309D&L=DOTNET-CLR&P=R5347&I=-3

There are people that still use it for services. To all this people, please use System.Threading.Timer in 2.0 don't do it in 1.1. I believe there is still a bug assign to that one:

http://support.microsoft.com/?id=900822

Also, please rememeber that System.Threading.Timer  is not thread safe, even being on the Threading namespace is not thread safe, so real this awesome article from Alex Calvo for a safe service programming ;-)

http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx

Hope this helps people to debug why their service stops calling the TimeElapsed function and why is not every X seconds.

Cheers

Al

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (4)

First add the Toolkit "AtlasControlToolkit.dll" by right clicking the ToolKit box and selecting Add Item.

That shall create and add all DLLs you need. Drag and drop any item into a webform to force Visual Studio 2005 to add the appropriate reference in the bin directory.

 

Changes on the web.config:

 

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

  <configSections>

    <sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">

      <section name="webServices" type="Microsoft.Web.Configuration.WebServicesSection" requirePermission="false"/>

    sectionGroup>

  configSections>

 

<microsoft.web>

    <webServices enableBrowserAccess="true" />

  microsoft.web>

 

 

Only once per page you need to add this tag. So if you are using master pages, this is where you want to add this:

 

<atlas:ScriptManager id="ScriptManager" EnablePartialRendering="true" runat="Server">atlas:ScriptManager>

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

All this will provide you with Atlas in any web project with ASP.NET 2.0 and Visual Studio 2005. Start playing with

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">

They are very powerful.

 

Cheers

Al

 

 

Only once per page you need to add this tag. So if you are using master pages, this is where you want to add this:

 

<atlas:ScriptManager id="ScriptManager" EnablePartialRendering="true" runat="Server">atlas:ScriptManager>

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

All this will provide you with Atlas in any web project with ASP.NET 2.0 and Visual Studio 2005. Start playing with

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">

They are very powerful.

 

Cheers

Al

 

<microsoft.web>

    <webServices enableBrowserAccess="true" />

  microsoft.web>

 

 

Only once per page you need to add this tag. So if you are using master pages, this is where you want to add this:

 

<atlas:ScriptManager id="ScriptManager" EnablePartialRendering="true" runat="Server">atlas:ScriptManager>

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

All this will provide you with Atlas in any web project with ASP.NET 2.0 and Visual Studio 2005. Start playing with

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">

They are very powerful.

 

Cheers

Al

 

 

Only once per page you need to add this tag. So if you are using master pages, this is where you want to add this:

 

<atlas:ScriptManager id="ScriptManager" EnablePartialRendering="true" runat="Server">atlas:ScriptManager>

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

All this will provide you with Atlas in any web project with ASP.NET 2.0 and Visual Studio 2005. Start playing with

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">

They are very powerful.

 

Cheers

Al

  configSections>

 

<microsoft.web>

    <webServices enableBrowserAccess="true" />

  microsoft.web>

 

 

Only once per page you need to add this tag. So if you are using master pages, this is where you want to add this:

 

<atlas:ScriptManager id="ScriptManager" EnablePartialRendering="true" runat="Server">atlas:ScriptManager>

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

All this will provide you with Atlas in any web project with ASP.NET 2.0 and Visual Studio 2005. Start playing with

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">

They are very powerful.

 

Cheers

Al

 

 

Only once per page you need to add this tag. So if you are using master pages, this is where you want to add this:

 

<atlas:ScriptManager id="ScriptManager" EnablePartialRendering="true" runat="Server">atlas:ScriptManager>

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

All this will provide you with Atlas in any web project with ASP.NET 2.0 and Visual Studio 2005. Start playing with

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">

They are very powerful.

 

Cheers

Al

 

<microsoft.web>

    <webServices enableBrowserAccess="true" />

  microsoft.web>

 

 

Only once per page you need to add this tag. So if you are using master pages, this is where you want to add this:

 

<atlas:ScriptManager id="ScriptManager" EnablePartialRendering="true" runat="Server">atlas:ScriptManager>

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

All this will provide you with Atlas in any web project with ASP.NET 2.0 and Visual Studio 2005. Start playing with

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">

They are very powerful.

 

Cheers

Al

 

 

Only once per page you need to add this tag. So if you are using master pages, this is where you want to add this:

 

<atlas:ScriptManager id="ScriptManager" EnablePartialRendering="true" runat="Server">atlas:ScriptManager>

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

Also you need to register the DLLS on the page:

@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit"

 

All this will provide you with Atlas in any web project with ASP.NET 2.0 and Visual Studio 2005. Start playing with

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">

They are very powerful.

 

Cheers

Al

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (0)

Lately is you are using Visual Studio 2005, and of course if you have been writing code since 1.1 or even 1.0, you are used to use functions like:

 

RegisterStartupScript()

 

Well now you’ll get one of the warnings that are just giving me a headache:

This method is now obsolete.

 

Lets find out why? Just because there is an attribute to that method to produce the warning. I would like to know what that actually means?

 

[ObsoleteAttribute("The recommended alternative is ClientScript.RegisterStartupScript(Type type, string key, string script). http://go.microsoft.com/fwlink/?linkid=14202")] public virtual void RegisterStartupScript ( string key, string script )

 

http://msdn2.microsoft.com/en-us/library/system.web.ui.page.registerstartupscript.aspx

 

Does it mean that the guts are using old technology? Does it mean that they just wrapped around the function with the new one in order to move it somewhere else? Does it mean they won’t support it on version 3.0 so get used to use the new one? Does it mean they find a better way? If so, why there just left it in the namespace?

 

Anybody can let me know, why?

 

Cheers

Al

Tags: | Categories: Blog Posted by admin on 3/9/2009 5:54 PM | Comments (1)

Finally many unknowns on the problems with VS2005 have been “resolved”. Found this post on the msdn blogs from PeterL a Visual Web Developer Tester http://blogs.msdn.com/petel/archive/2006/07/03/655422.aspx

Lettings us know that cleaning the registry or screwing with the registry is not a good idea. Actually a few tools that claim cleaning the registry is not a good idea, this may prove that. How a tool knows what keys are actually safe to remove?

 

Please keep sending me emails about your problems with Visual Studio 2005. I have been trying to reproduce them as well as log the results. Hopefully one of these weekends I’ll add them all in a post with possible solutions.

 

Cheers

Al