Click here to Skip to main content
15,905,607 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Help needs in Logging In Pin
Senthil S4-Nov-08 2:19
Senthil S4-Nov-08 2:19 
AnswerRe: Help needs in Logging In Pin
saanj4-Nov-08 6:03
saanj4-Nov-08 6:03 
AnswerRe: Help needs in Logging In Pin
D4ever6-Nov-08 8:17
D4ever6-Nov-08 8:17 
QuestionUsers Bypass the Login Screen Pin
Vimalsoft(Pty) Ltd4-Nov-08 1:26
professionalVimalsoft(Pty) Ltd4-Nov-08 1:26 
AnswerRe: Users Bypass the Login Screen Pin
Brij4-Nov-08 2:47
mentorBrij4-Nov-08 2:47 
GeneralRe: Users Bypass the Login Screen Pin
Vimalsoft(Pty) Ltd4-Nov-08 2:54
professionalVimalsoft(Pty) Ltd4-Nov-08 2:54 
AnswerRe: Users Bypass the Login Screen Pin
Brij4-Nov-08 3:02
mentorBrij4-Nov-08 3:02 
GeneralRe: Users Bypass the Login Screen Pin
Vimalsoft(Pty) Ltd5-Nov-08 0:43
professionalVimalsoft(Pty) Ltd5-Nov-08 0:43 
Yes i did use Session.abandon(). Let me elaborate more clearer about my Situation.

i have created my Login Page and it was two Buttons and we will look into the button that does login in my login Button i have the Following

protected void btlogin_Click(object sender, EventArgs e)
    {
        String strusername = txtUsername.Text;

        String strPassword = txtPassword.Text;

        
        BLL.BLL obj = new BLL.BLL();

    
       int bl = 0;

        try
        {

            bl = obj.Check_Login(strusername, strPassword);

            if (bl == 1)
            {
                Session["USERNAME"] = strusername;

                Response.Redirect("Welcome.aspx", false);
            }

            else
            {

                Response.Write("<script language='javascript'>alert('Invalid Login');</script>");

            }
        }

        catch (Exception)
        {

            Response.Write("<script> alert('ex.Message');</script>");
        }
    }


Now i have my Business logic that Calls the Function that Calls the function in a Data Access Layer that will call the StoreProcedure.

like this


public int Check_Login(String username, String password)
        {

            int ans = 0;

            DAL.DAL obj = new DAL.DAL();

            try
            {
                ans = obj.Check_Login(username, password);
            }
            catch (Exception)
            {
                throw;
            }
            return ans;
        }


and from the DAL i execute my SP like this

public int Check_Login(String Username, String Password)
        {

            con = new SqlConnection(strconlogin);

            cmdselect = new SqlCommand();


            cmdselect.CommandTimeout = 0;


            cmdselect.CommandType = CommandType.StoredProcedure;


            cmdselect.CommandText = "dbo.prcLoginv";


            cmdselect.Parameters.Add("@User_name", SqlDbType.VarChar, 50, "UserName").Value = Username;


            cmdselect.Parameters.Add("@U_Password", SqlDbType.VarChar, 50, "UPassword").Value = Password;


            cmdselect.Parameters.Add("@Results", SqlDbType.Int);


            cmdselect.Parameters["@Results"].Direction = ParameterDirection.Output;


            cmdselect.Connection = con;


            int res = 0;

            try
            {
                con.Open();

                cmdselect.ExecuteNonQuery();

                res = Convert.ToInt32(cmdselect.Parameters["@Results"].Value);

                con.Close();
            }
            catch (SqlException)
            {
                throw;

            }

            return res;
        }



Now all my Pages Contains this Code , excluding the login page


Response.Write("<script> window.history.forward(1);</script>");

        if (Session["USERNAME"] == "")
        {

            Response.Redirect("login.aspx");
        }


Well here i was to redirect the Users to the login page if the Session Variable is Empty. Well from the Developement site it works but as i said the User can use a full URL to go to a Certain page.


Thank you

Vuyiswa Maseko,

Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding

VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za


QuestionSql Database Pin
shanthi jothi4-Nov-08 0:37
shanthi jothi4-Nov-08 0:37 
AnswerRe: Sql Database Pin
Vimalsoft(Pty) Ltd4-Nov-08 0:55
professionalVimalsoft(Pty) Ltd4-Nov-08 0:55 
AnswerRe: Sql Database Pin
J a a n s4-Nov-08 1:12
professionalJ a a n s4-Nov-08 1:12 
GeneralRe: Sql Database Pin
shanthi jothi4-Nov-08 1:38
shanthi jothi4-Nov-08 1:38 
AnswerRe: Sql Database Pin
Ashfield4-Nov-08 1:30
Ashfield4-Nov-08 1:30 
QuestionTextBox ID Problem Pin
raghvendrapanda4-Nov-08 0:23
raghvendrapanda4-Nov-08 0:23 
AnswerRe: TextBox ID Problem Pin
Ashfield4-Nov-08 0:26
Ashfield4-Nov-08 0:26 
GeneralRe: TextBox ID Problem Pin
raghvendrapanda4-Nov-08 0:35
raghvendrapanda4-Nov-08 0:35 
GeneralRe: TextBox ID Problem Pin
Ashfield4-Nov-08 1:32
Ashfield4-Nov-08 1:32 
Question3-Tier Architecture Pin
Samiullah4-Nov-08 0:17
Samiullah4-Nov-08 0:17 
AnswerRe: 3-Tier Architecture Pin
Ashfield4-Nov-08 0:27
Ashfield4-Nov-08 0:27 
AnswerRe: 3-Tier Architecture Pin
Vimalsoft(Pty) Ltd4-Nov-08 0:52
professionalVimalsoft(Pty) Ltd4-Nov-08 0:52 
AnswerRe: 3-Tier Architecture Pin
Brij4-Nov-08 2:55
mentorBrij4-Nov-08 2:55 
Questiongrid view problem Pin
ptvce4-Nov-08 0:00
ptvce4-Nov-08 0:00 
Questiongrid view Pin
ptvce3-Nov-08 23:56
ptvce3-Nov-08 23:56 
AnswerRe: grid view Pin
Sneha Bisht4-Nov-08 0:21
Sneha Bisht4-Nov-08 0:21 
GeneralRe: grid view Pin
ptvce4-Nov-08 0:28
ptvce4-Nov-08 0:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.