|
Are You Using Sessions or forms authentication..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hey i just write it for sample. I know form authentication and other . Please provide me what to do after log in success.
|
|
|
|
|
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["Loginerrors"] = 0;
}
}
private bool validate(String Uname, String Pwd)
{
bool val = false;
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["sqlcon"].ToString());
string qry = "Select Uname, Pwd FROM login";
SqlCommand cmd = new SqlCommand(qry, con);
SqlDataReader dr;
con.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
if ((Uname == dr["Uname"].ToString()) & (Pwd == dr["Pwd"].ToString()))
{
val = true;
}
dr.Close();
return val;
}
return val;
}
protected void Login1_Authenticate(object sender, EventArgs e)
{
if (validate(Login1.UserName,Login1.Password))
{
Login1.Visible = false;
Label1.Text = "Success";
}
else
{
Label1.Text = "Failed";
}
}
}
Is this code efficient for login
|
|
|
|
|
Hi all,
I have checkboxes in datagrid to select and a delete button outside the datagrid to delete the checked row in datagrid. After checking the check box and clicking the delete button, in the btndelete_Click im finding the check box in the datagrid and deleting the particular record, but im getting the checked false in the btndelete_Click of the datagrid checkbox which is checked. Please tell me why it is so and how can i find the checkbox of datagrid is checked or not in button click. The code is below:
protected void btnDelete_Click(object sender, EventArgs e)
{
foreach (DataGridItem DemoGridItem in grid.Items)
{
CheckBox oCheckbox = (CheckBox)DemoGridItem.Cells[1].FindControl("chkDelete");
HiddenField hidImageName = (HiddenField)DemoGridItem.Cells[1].FindControl("hdnItem");
if (oCheckbox.Checked == true)
{
try
{
Delete code;
}
catch( Exception e)
{
}
}
}
}
Thanks in advance for ur help.
|
|
|
|
|
The real question is, where do the checkboxes come from ? Best guess, your page load is binding to the datasource and erasing any selected items.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have created menu from scripting using
|
|
|
|
|
if You are using forms authentication use this
if (Page.User.Identity.IsAuthenticated)
{
}
or if You are using session check the session
If this is not your answer Sorry..!
Then be More clear..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
thnks for ur reply bro...............but i think u r not getting my question..........i hav created menu in html using UL tag,LI tag, and ANCHOR tag with scripting...............in this condition how to check .......
|
|
|
|
|
I have 2 questions for this.
1)Why would you go for html tags rather than using Navigation control in asp.net.
2)How You are checking for particular user whether he is logged in or not..!
KhandelwalA wrote: i hav created menu in html using UL
Then You are redirecting to particular page .Check the login condition.
But IMO Its not good.
But If you are using forms authentication . forms authentication will take care of it..!
Thts the advantage of forms authentication.
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
If your security system works at all, then a pure link is fine because your page itself will check if the user is logged in. On the other hand, a good design would not show options that the user is not allowed to access. Giving people the URLs to your pages that they can't access, is a good first step to their trying to break in.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
<script type="text/javascript">
function Test() {
var hidPWD = document.getElementById('<%=hidPassword.ClientID%>');
var txtPWD = document.getElementById('<%=txtPWD.ClientID%>');
hidPWD.value = txtPWD.value;
alert(hidPWD.value);
var hidConfirmPWD = document.getElementById('<%=hidConfirmPWD.ClientID%>');
var txtConfirmPWD = document.getElementById('<%=txtConfirmPWD.ClientID%>');
hidConfirmPWD.value = txtConfirmPWD.value;
alert(hidConfirmPWD.value);
}
</script>
I am try to store my password and confirmpass in some hidden field to maintain text(password) after pageload but its not working.
|
|
|
|
|
bhavnvyas wrote: I am try to store my password and confirmpass in some hidden field to maintain text(password) after pageload but its not working.
Well, your basic idea is kind of bizarre. Why would you need this ? Your control will keep it's value after pageload, unless you change it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
no my password in textbox is erased after pageload
|
|
|
|
|
Hi all,
I am using ASP in that i want to know how to hide the query string part in the address bar.
For example,
I have defined a hyperlink as
<a href="http://mywebsite.com/sumpage.asp?action=xyz"></a>
so, in browser i want to show only
http://mywebsite.com/sumpage.asp and hide the rest of the part.
How can i do it ??
Thanks in advance..
|
|
|
|
|
You can't. You can perhaps encrypt it, but there is no way to hide it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
Your basic problem is finding an encryption algorithm that doesn't contain forbidden characters. What are you actually trying to achieve ? If something should be kept secret, you should not send it to the client at all. Wanting to encrypt your query string makes me feel that your design is broken to start with.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
|
How can I use OnRowCreated="grdFeeHead_RowCreated"
OnRowEditing="grdFeeHead_RowEditing" OnRowCancelingEdit="grdFeeHead_RowCancelingEdit"
OnRowUpdating="grdFeeHead_RowUpdating" event in c# ASP.NET
|
|
|
|
|
What have you tried ? Do you own any books ? Did you read any articles ? What do you expect these things to do ? Is this a totally random question, or do you have something specific you want to achieve ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
i want to implement membership in my project.
i read about it...and find we can create roles using web site administration tool.
but my requirement is that the client wants to change the roles of users on daily bases.
how this can we achieved using roles in asp.net 2.0
One person's data is another person's program.
--J.Walia
|
|
|
|
|
The best way IMO is to write your own system, not use the built in rubbish.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Dont make it difficult for this guy Chris, it looks like he is new, so using the included membership system is the best option in this case
Alexei Rodriguez
|
|
|
|
|
You have to do it programmatically..!
for eg:to find the roles of the user
Response.Write (User.Identity.Name + " is a member of " + Roles.GetRolesForUser().Length + " Roles.<BR>");
Response.Write("User Roles" + "<BR>");
foreach (string role in Roles.GetRolesForUser())
{
Response.Write(role.ToString() + "<BR>");
}
Response.Write("All Roles" + "<BR>");
foreach (string role in Roles.GetAllRoles())
{
Response.Write(role.ToString() + "<BR>");
}
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|