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?

Answers were Sorted based on User's Feedback



If I'm developing an application that must accommodate multiple security levels though secure ..

Answer / a

http://www.codeproject.com/KB/webforms/NingLiangSimpleContro
l.aspx

Is This Answer Correct ?    0 Yes 0 No

If I'm developing an application that must accommodate multiple security levels though secure ..

Answer / b

http://forums.asp.net/t/1316768.aspx

Is This Answer Correct ?    0 Yes 0 No

If I'm developing an application that must accommodate multiple security levels though secure ..

Answer / b

http://forums.asp.net/t/1159696.aspx

Is This Answer Correct ?    0 Yes 0 No

If I'm developing an application that must accommodate multiple security levels though secure ..

Answer / 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

If I'm developing an application that must accommodate multiple security levels though secure ..

Answer / 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

If I'm developing an application that must accommodate multiple security levels though secure ..

Answer / a

/* Alternate row color */

for (int j = 0; j < dstNew.Tables[0].Rows.Count; j++) {
if (j % 2 == 0) {
sb.Append("<tr class=\"row\">");
}else{
sb.Append("<tr
class=\"altRow\">");
}
sb.Append("<td>" + dstNew.Tables
[0].Rows[j]["DivisionID"] + "</td>");
sb.Append("<td>" + dstNew.Tables
[0].Rows[j]["DivisionName"] + "</td>");
sb.Append("</tr>");
}


/* Style */

.row{
background-color:Gray;
}
.alrRow{
background-color:Olive;
}

Is This Answer Correct ?    0 Yes 0 No

If I'm developing an application that must accommodate multiple security levels though secure ..

Answer / a

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 string expandAll = 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 (Request.QueryString["expandAll"] != null) {
expandAll = Request.QueryString
["expandAll"].ToString();
}

if (expandAll.Equals("1")) {
Session.Remove("projCode");
for (int i = 0; i < dst.Tables[0].Rows.Count;
i++) {
if (Session["projCode"] != null && Session
["projCode"].ToString() != string.Empty) {
Session["projCode"] = Session
["projCode"].ToString() + dst.Tables[0].Rows[i]
["ProjCode"].ToString() + ",";
} else {
Session["projCode"] = dst.Tables[0].Rows
[i]["ProjCode"].ToString() + ",";
}
}
} else if (expandAll.Equals("0")) {
Session.Remove("projCode");
}

if (Session["projCode"] != null && Session
["projCode"].ToString() != string.Empty) {
if (expand.Equals("1")) {
Session["projCode"] = Session
["projCode"].ToString() + projCode + ",";
} else if(expand.Equals("0")) {
Session["projCode"] = Session
["projCode"].ToString().Replace((projCode + ","), "");
}
} else {
if (!projCode.Equals(string.Empty)) {
Session["projCode"] = projCode + ",";
} else {
Session["projCode"] = string.Empty;
}
}

string sProjCode = string.Empty;
sProjCode = Session["projCode"].ToString();

sb.Append("<tr>");
sb.Append("<td>");

if (expandAll.Equals("1")) {
sb.Append("<a href=\"../UI/Default3.aspx?
expandAll=0\">Collapse all</a>");
} else {
sb.Append("<a href=\"../UI/Default3.aspx?
expandAll=1\">Expand all</a>");
}

sb.Append("</td>");
sb.Append("</tr>");

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++) {
if (j % 2 == 0) {
sb.Append("<tr class=\"row\">");
}else{
sb.Append("<tr
class=\"altRow\">");
}
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("</td>");
sb.Append("</tr>");

}
projTable = sb.ToString();
}




}
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

If we write return statement in finally block will it works fine or throws any error?

1 Answers   Patni,


What is Web Server Control Templates.?

0 Answers   MCN Solutions,


What is data reader in asp.net?

0 Answers  


what is shared assembly?

2 Answers   Microsoft,


What is a runtime version?

0 Answers  






In SP has contains 10 query,By Using Dataset Object I need to fetch 8th query of records? How?

5 Answers  


What is viewstate?

6 Answers   Abacus, Microsoft, Sopra,


What can we do with asp.net?

0 Answers  


Name and describe some HTTP Status Codes and what they express to the requesting client ?

1 Answers  


What is cross page posting? How is it done?

0 Answers  


How do pass data from one layer to another layer in N-tier architecture?

2 Answers  


what is use of web.config?

3 Answers  


Categories