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

To display data in the combo box, prior to setting the Data Source, what kind of property on a Combo Box do you set with a column name?

596


What is strong-typing versus weak-typing?

575


What are the server control tags in asp.net.?

613


How do http sessions work?

497


Define viewstate in .net?

534






What is Web API Routing?

597


What is cas?

589


i want to implement grid view value in paypal site. so how to create this code in asp.net with C#

1486


Where is session data stored in asp net?

506


What is data caching?

547


What is the size of Get method and how much data it can store?

556


Which protocol is used in a web api?

554


What is an assembly? Explain its parts.

621


How do you secure your connection string information?

508


Why is an object pool required?

600