If I'm developing an application that must accommodate
multiple security levels though secure login and my ASP.NET
web application is spanned across three web-servers (using
round-robin load balancing) what would be the best approach
to maintain login-in state for the users?

Answer Posted / a

/* Deafult.aspx.cs */

using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text;

public partial class UI_Default3 : System.Web.UI.Page
{
public string projTable = string.Empty;
public string projCode = string.Empty;
public DataSet dst = null;
protected void Page_Load(object sender, EventArgs e)
{
dst = new DataSet();
dst = PopulateData.LoadProject();
StringBuilder sb = new StringBuilder();

if (Request.QueryString["projCode"] != null) {
projCode = Request.QueryString
["projCode"].ToString();
}

if(dst.Tables[0].Rows.Count > 0){
for (int i = 0; i < dst.Tables[0].Rows.Count;
i++) {
sb.Append("<tr>");
sb.Append("<td>");
sb.Append("<a href=\"../UI/Default3.aspx?
projCode=" + dst.Tables[0].Rows[i]["ProjCode"] + "\"><img
src=\"../Images/Tree.GIF\" /></a>");
sb.Append("</td>");
sb.Append("<td>");
sb.Append("<a href=\"../UI/Default3.aspx?
projCode=" + dst.Tables[0].Rows[i]["ProjCode"] + "\">" +
dst.Tables[0].Rows[i]["ProjDesc"] + "</a>");
sb.Append("</td>");
sb.Append("</tr>");

sb.Append("<tr>");
sb.Append("<td colspan=\"2\">");

if (!projCode.Equals(string.Empty) &&
projCode.Equals(dst.Tables[0].Rows[i]["ProjCode"].ToString
())) {
DataSet dstNew = new DataSet();
dstNew = PopulateData.LoadDivision
(projCode);

sb.Append("<table border=\"1\" >");
sb.Append("<tr>");
sb.Append("<td>Division ID</td>");
sb.Append("<td>Division Name</td>");
sb.Append("</tr>");

for (int j = 0; j < dstNew.Tables
[0].Rows.Count; j++) {
sb.Append("<tr>");
sb.Append("<td>" + dstNew.Tables
[0].Rows[j]["DivisionID"] + "</td>");
sb.Append("<td>" + dstNew.Tables
[0].Rows[j]["DivisionName"] + "</td>");
sb.Append("</tr>");
}
sb.Append("</table>");
projCode = string.Empty;
}

sb.Append("<tr>");
sb.Append("<td>");
}
projTable = sb.ToString();
}




}
}

-----------------------------------------------------------

/* Default.aspx */

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default3.aspx.cs" Inherits="UI_Default3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<% =projTable %>
</table>
</div>
</form>
</body>
</html>

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a server cookie?

591


What is css and what is it used for?

636


What is inheritance and an how it be used, example with an example?

662


What is Cookies Less Session?

701


Explain the difference between array and linkedlist?

599






We are using Jscriopt validations and at clint site javascript is not running that time validation would work? if yes then how it would behave?

1491


How can we pass info between 2 asp.net pages?

662


How we implement the multiple paypal value with gridview in my website and how we make a payment through Credit Card.

1520


What is the difference between localization and globalization?

660


What is difference between viewstate and session in asp net?

637


Explain the difference between asp.net mvc and asp.net webforms

678


Explain automatic memory management in .net.

669


How ViewstateMac works?

2456


What are the modes of updation in an updatepanel? What are triggers of an updatepanel?

590


Define static member?

634