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
What is a server cookie?
What is css and what is it used for?
What is inheritance and an how it be used, example with an example?
What is Cookies Less Session?
Explain the difference between array and linkedlist?
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?
How can we pass info between 2 asp.net pages?
How we implement the multiple paypal value with gridview in my website and how we make a payment through Credit Card.
What is the difference between localization and globalization?
What is difference between viewstate and session in asp net?
Explain the difference between asp.net mvc and asp.net webforms
Explain automatic memory management in .net.
How ViewstateMac works?
What are the modes of updation in an updatepanel? What are triggers of an updatepanel?
Define static member?