Click here to Skip to main content
15,899,825 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Has anyone figured out why the the Confirm dialog box doesn't work in the following article Pin
Eduard Keilholz14-Oct-08 21:09
Eduard Keilholz14-Oct-08 21:09 
GeneralRe: Has anyone figured out why the the Confirm dialog box doesn't work in the following article Pin
Tina P15-Oct-08 14:25
Tina P15-Oct-08 14:25 
Question[Message Deleted] Pin
jagadish reddy14-Oct-08 17:00
jagadish reddy14-Oct-08 17:00 
AnswerRe: Can any one help Regarding meta tags Pin
Eduard Keilholz14-Oct-08 20:11
Eduard Keilholz14-Oct-08 20:11 
Questionvisual studio2005,SQL Data source problem Pin
amit201114-Oct-08 6:50
amit201114-Oct-08 6:50 
AnswerRe: visual studio2005,SQL Data source problem Pin
Gayani Devapriya14-Oct-08 18:34
Gayani Devapriya14-Oct-08 18:34 
AnswerRe: visual studio2005,SQL Data source problem Pin
Abhijit Jana14-Oct-08 19:59
professionalAbhijit Jana14-Oct-08 19:59 
QuestionLoad balancer implementation problem Pin
imak14-Oct-08 5:25
imak14-Oct-08 5:25 
I am trying to simulate a web-farm environment and I need to implement a simple ad balancer layer for this(C#/ASP.NET 2.0, IIS 5.1). I am doing it via folwing architecture. Feel free to suggest any flaws that can help me resolve the problem.

I have a web-application named LoadBalancer (LB) which has lists of hosts that it needs to connect. All the hosts are running exactly same web application. So let’s say when users connects to LB, it takes him/her to a web-form on app running on Machine1. User hits a button here but let’s say that Mafchine1 becomes unavailable now, which means that LB should try connecting to application running on Machine2. This mean that I need to capture every http request in LB, see which is the device I am currently connected to , Make sure its avaialble (otherwise get the availabe machine’s URL) and then post the http request to that machine. I tried doing it in Application_PreRequestHandlerExecute event but could not figure out how to do it. Bew is the simplied code that I currently have in Gabal.asax.

My questions.
1. Can this be done?
2. My current approach can work?
3. Any code samples will be highly appreicated.

TIA


<%@ Application Language="C#" %>

<script runat="server">

void Application_Start(object sender, EventArgs e)
{
System.Collections.Generic.List<string> ListOfMachines = new System.Collections.Generic.List<string>();
int index = 0;

// Hard-coded for brevity
ListOfMachines.Add("http://Machine1/MyWebApp/");
ListOfMachines.Add("http://Machine2/MyWebApp/");
ListOfMachines.Add("http://Machine3/MyWebApp/");
Application["MachinesList"] = ListOfMachines;
Application["CurrentIndex"] = index;
}

void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown

}

void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs

}

void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
string NextMachineURL = GetNextAvailableMachine(); // This returns the URL from MachinesList in round-robin fashion

// *** Establish the request
System.Net.HttpWebRequest HttpReq = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(NextMachineURL);

// *** Retrieve request info headers
System.Net.HttpWebResponse WebResponse = (System.Net.HttpWebResponse)HttpReq.GetResponse();

System.IO.StreamReader ResponseStream =
new System.IO.StreamReader(WebResponse.GetResponseStream(), enc);

string strHtml = ResponseStream.ReadToEnd();
System.Web.HttpContext.Current.Response.Write(strHtml);
WebResponse.Cse();
ResponseStream.Cse();

break;

}

void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.

}



</script>
AnswerRe: Load balancer implementation problem Pin
Abhijit Jana14-Oct-08 20:06
professionalAbhijit Jana14-Oct-08 20:06 
GeneralRe: Load balancer implementation problem Pin
imak15-Oct-08 0:48
imak15-Oct-08 0:48 
QuestionJavascript question!! Pin
papy-boom14-Oct-08 3:47
papy-boom14-Oct-08 3:47 
AnswerRe: Javascript question!! Pin
Abhijit Jana14-Oct-08 4:06
professionalAbhijit Jana14-Oct-08 4:06 
AnswerRe: Javascript question!! Pin
Abhishek Sur14-Oct-08 5:24
professionalAbhishek Sur14-Oct-08 5:24 
QuestionHTML Table in asp.net Pin
sachees12314-Oct-08 3:38
sachees12314-Oct-08 3:38 
AnswerRe: HTML Table in asp.net Pin
J4amieC14-Oct-08 4:06
J4amieC14-Oct-08 4:06 
AnswerRe: HTML Table in asp.net Pin
bcozican15-Oct-08 2:08
bcozican15-Oct-08 2:08 
GeneralRe: HTML Table in asp.net Pin
sachees12315-Oct-08 18:46
sachees12315-Oct-08 18:46 
QuestionProblem in developing a simple composite control (MathBox): event handling and raising Pin
Enayat Ashkian14-Oct-08 3:34
Enayat Ashkian14-Oct-08 3:34 
AnswerRe: Problem in developing a simple composite control (MathBox): event handling and raising Pin
Abhishek Sur14-Oct-08 5:25
professionalAbhishek Sur14-Oct-08 5:25 
GeneralRe: Problem in developing a simple composite control (MathBox): event handling and raising Pin
Enayat Ashkian14-Oct-08 6:38
Enayat Ashkian14-Oct-08 6:38 
Questionhow can we insert data into the data base using web services Pin
raghvendrapanda14-Oct-08 3:15
raghvendrapanda14-Oct-08 3:15 
AnswerRe: how can we insert data into the data base using web services Pin
Abhishek Sur14-Oct-08 5:34
professionalAbhishek Sur14-Oct-08 5:34 
Questionasp.net role manager Pin
eyeseetee14-Oct-08 2:14
eyeseetee14-Oct-08 2:14 
AnswerRe: asp.net role manager Pin
bcozican14-Oct-08 2:45
bcozican14-Oct-08 2:45 
GeneralRe: asp.net role manager Pin
eyeseetee14-Oct-08 2:46
eyeseetee14-Oct-08 2:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.