hi,
i m trying to do my library project in C#,i am new to this language i dont know how to write login code in c#,can sombody help me

Nobody is going to do your work for you, fix your "borrowed" code for you, or be interested in attempting to help you until you read our posting guidelines and start acting smarter. Honestly, if you're so new to C# then why are you trying to do a program that's so obviously beyond your capabilities?

Nobody is going to do your work for you, fix your "borrowed" code for you, or be interested in attempting to help you until you read our posting guidelines and start acting smarter. Honestly, if you're so new to C# then why are you trying to do a program that's so obviously beyond your capabilities?

Please don't abate the new programmer's zeal he just asked! i don't know too, if i knew that i would help him. Don't forget everybody was that level at the start! i'm sorry but knowledge grows up with shareing...

But the question he asked was so open ended. Is it windows or web or web services login? VS2002, 2003, 2005? What datasource? XML? SQL Server 2000? SQL Server 2005? Notepad? Webconfig? Excel? Access? etc. Login for the whole app or part of it?

So thats why he was "jumped on". for not reading the guidelines. We help those who help themselves. Too many people want someone to do all their work, project or homework for them. I saw one post in here where a woman typed in all 100 questions of her homework. It took her longer to type them to be answered by us than it would have taken her to look up the answers!

You're right f1 fan but no one can guess that he trying to do that like your exemplary, anyway here is a sharing and assisting platform. Narue can advice him to read a web source or a book. He said that he is new to this language, i think he is not so strange to programming languages.
Whatever it's non of my business to encourage him! i'm trying to be a programmer, when i read this subject i anamnesised that no one help's me too. is that means a programming is a secret? i'm asking my programmer friend's how to make blabla, how can i find a rich content book, let's recommend me.... But neither one's helps and answers me!

There is a big difference between asking a specific question (as in your other post about the external program) and a general "someone write my program for me" question.
People will always help someone out who is stuck but at least show you have tried some things first.
You cannot tell me that if you put "login code c#" in google you wont get at least 100 hits with some examples of code in there. So he didnt even bother to do that, but asked someone to write it for him and send it.

he trying to do that like your exemplary... when i read this subject i anamnesised that no one help's me ...!

exemplary? anamnesised? do you run your posts through some wierd thesaurus?

Comments

i understand you f1 fan. i said it's none of my business to encourage him. Probably i'm a bit sensitive.. :p Thanks for your replys..

exemplary? anamnesised? do you run your posts through some wierd thesaurus?

it's not wierd it's weird! and no i don't use a thesaurus or a dictionary. it's just my own english!

Look in the Tutorials section of the site Paladine did a great C# login tutorial for ASP.Net. Take a look might be some help. Look in the ASP.Net section. I am also new to c#. Don't get discouraged. To everyone else - Don't pick on people try channeling that hatered into soemthing usefull or don't bother replying at all. It is just a big waste of everyones time.

hi,
i m trying to do my library project in C#,i am new to this language i dont know how to write login code in c#,can sombody help me

it's not wierd it's weird! and no i don't use a thesaurus or a dictionary. it's just my own english!

but it's NOT english. Exemplary is an adjective, not a noun. Anamemnis is a noun, not a verb.

hai Iam Rajesh ,iam sending the login code in C# , this is my email id
;rajeshkvsn@infotechsw.com ,if u have any doubts you can mail me


Login code in C#:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Configuration;
namespace ics
{
 /// <summary>
 /// Summary description for Login.
 /// </summary>
 public partial class Login : System.Web.UI.Page
 {
  protected System.Web.UI.WebControls.ImageButton ImageButton1;
 
  protected void Page_Load(object sender, System.EventArgs e)
  {
   // Put user code to initialize the page here
  }
  #region Web Form Designer generated code
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.
   //
   InitializeComponent();
   base.OnInit(e);
  }
  
  /// <summary>
  /// Required method for Designer support - do not modify
  /// the contents of this method with the code editor.
  /// </summary>
  private void InitializeComponent()
  {    
   this.ibtnSubmit.Click += new System.Web.UI.ImageClickEventHandler(this.ibtnSubmit_Click);
  }
  #endregion
  private void ibtnSubmit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  {
   string s=ConfigurationSettings.AppSettings["connstr"].ToString();
   SqlConnection cn=new SqlConnection(s);
  ;
   string query="select * from ics_login where log_username="+txtUsername.Text+" and log_password='"+txtPassword.Text+"'";
   SqlCommand cmd=new SqlCommand(query,cn);
   cn.Open();
   SqlDataReader dr=cmd.ExecuteReader();
   if(dr.Read())//valid user
   {
    Session["user"]=txtUsername.Text;
    Session["conn"]=s;
    if(dr[3].ToString()=="0")
     Response.Redirect("ChangePassword.aspx?un="+txtUsername.Text );
    else
    {
     Session["role"]=dr[2].ToString();
     
     Response.Redirect("main.aspx");
    }
   }
   else//invalid user
   {
   Page.RegisterStartupScript("as","<script> alert('User name or password is wrong')</script>");
   }
  }
 }
}

that login code will leave you open to an sql injection attack. Never take input directly from an input and put it directly into an sql query

but it's NOT english. Exemplary is an adjective, not a noun. Anamemnis is a noun, not a verb.

People should not try to get cute with the English Language on boards that are read by many peoples around the world -- English is not the native language of many of our posters. And no one expects anyone to be English professors either; expertise in the English language is not a prerequisite for posting here either.

that login code will leave you open to an sql injection attack. Never take input directly from an input and put it directly into an sql query

It depends on what exactly the intended use is. If it's just for a little in-house program that nobody else will see or be interested in then it's fine.

Also I am amazed at some of the replies here, arguing over the use of English and about Coool Pinky asking a question.

Nobody is going to do your work for you, fix your "borrowed" code for you, or be interested in attempting to help you until you read our posting guidelines and start acting smarter. Honestly, if you're so new to C# then why are you trying to do a program that's so obviously beyond your capabilities?

I often ask questions asking for help with things beyond my capability, if I was able to do it I wouldn't have to ask in the first place, surely?

i m trying to do my library project in C#,i am new to this language i dont know how to write login code in c#,can sombody help me

The original title is asking for code but here he/she asks for help. My opinion would be to ignore the title, and provide as many useful links as I could. I know I haven't submitted any in this post, but my reasoning will be clear at the end of this. Remember as developers the idea is to re-use code. Even just asking what Coool Pinky had already or what way it was to be done would have been a start!

We'll help you get started, exchange algorithm ideas, how-to's, etc. but only if you show that you're willing to put in effort as well.

Plus a standard forum netiquette has been broken, necro'ing a thread that is well over 1 year old. If he still needs this now he is in big trouble :lol: Ah well, made me chuckle.

This article has been dead for over six months. Start a new discussion instead.