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 / b
using System;
using System.Data;
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 string expand = 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 (Request.QueryString["expand"] != null) {
expand = Request.QueryString["expand"].ToString
();
}
if (Session["projCode"] != null && Session
["projCode"].ToString() != string.Empty) {
if (expand.Equals("1")) {
Session["projCode"] = Session
["projCode"].ToString() + projCode + ",";
} else {
Session["projCode"] = Session
["projCode"].ToString().Replace((projCode + ","), "");
}
} else {
Session["projCode"] = projCode + ",";
}
string sProjCode = string.Empty;
sProjCode = Session["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>");
if (sProjCode.IndexOf(dst.Tables[0].Rows[i]
["ProjCode"].ToString()) >= 0) {
sb.Append("<a
href=\"../UI/Default3.aspx?projCode=" + dst.Tables[0].Rows
[i]["ProjCode"] + "&expand=0\"><img
src=\"../Images/close.GIF\" /></a>");
} else {
sb.Append("<a
href=\"../UI/Default3.aspx?projCode=" + dst.Tables[0].Rows
[i]["ProjCode"] + "&expand=1\"><img
src=\"../Images/open.GIF\" /></a>");
}
sb.Append("</td>");
sb.Append("<td>");
if (sProjCode.IndexOf(dst.Tables[0].Rows[i]
["ProjCode"].ToString()) >= 0) {
sb.Append("<a
href=\"../UI/Default3.aspx?projCode=" + dst.Tables[0].Rows
[i]["ProjCode"] + "&expand=0\">" + dst.Tables[0].Rows[i]
["ProjDesc"] + "</a>");
} else {
sb.Append("<a
href=\"../UI/Default3.aspx?projCode=" + dst.Tables[0].Rows
[i]["ProjCode"] + "&expand=1\">" + dst.Tables[0].Rows[i]
["ProjDesc"] + "</a>");
}
sb.Append("</td>");
sb.Append("</tr>");
sb.Append("<tr>");
sb.Append("<td colspan=\"2\">");
if (!sProjCode.Equals(string.Empty) &&
(sProjCode.IndexOf(dst.Tables[0].Rows[i]
["ProjCode"].ToString()) >= 0) ) {
DataSet dstNew = new DataSet();
dstNew = PopulateData.LoadDivision
(dst.Tables[0].Rows[i]["ProjCode"].ToString());
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>");
}
sb.Append("<tr>");
sb.Append("<td>");
}
projTable = sb.ToString();
}
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the namespaces used in asp.net mvc? : asp.net mvc
How can you handle errors in Web API?
What are the different types of events are occured when a client requests an ASP.NET page from IIS server?
Write the different features of a Thread and a Process?
What are the authentication types in asp.net?
How to integrate angular 8 with asp.net mvc 5? : Asp.Net MVC
What are the advantages of using Master Pages?
How do you hide the columns?
How to manage different kinds of sessions in ASP.NET?
What are the differences between application object and session object?
What is the difference between equals() and == in c#?
What is the use of service provider?
Explain the steps needed to be performed in order to create an animation in xaml?
What is rending process in ASP.NET?
What does a switch do?