Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2007, 11:12 AM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Direct selected users to edit page

I need help for the code below. This page display the user info based on their windows authentication user ID. It is working fine and I need that. Then it is also letting admin to edit anybodys profile…which is working fine too. Now I have created a table name UserCheck with username and editusername fields (just 2 fields). Now I want to link the table in this page where user can edit other user profile based on the username authorization in the table UserCheck…..Check if username is allowed to change editusername…if yes then direct to edit page else take him back to the main page…

Connection string is already built up in webconfig file…all I need to put connection to the table in this code……plz help and let me know if you didn’t understand anything….









protected void Page_Load(object sender, System.EventArgs e)

            {

                  string strUser,theUser,userToEdit,url;

                  int startPos;

                  strUser=System.Security.Principal.WindowsIdentity. GetCurrent().Name.ToString();

                  startPos=strUser.IndexOf('\\')+1;

                  theUser=strUser.Substring(startPos);





            Session["username"]=theUser;

                  Session["usernameToEdit"]=Request.QueryString["username"];

                  //if the admin is Sadia then she could edit anybody's profile.

                  if(theUser!="ssh001111")

                  {

                        Session["usernameToEdit"]=Session["username"].ToString();

                  }

                  //Checking to see if the user is present in the database

                  SPAHPUser fsUser = new SPAHPUser();

                  if(fsUser.UserExists(theUser)==1)

                  {

                        url="../Edit/EditUserDetails.aspx?action=edit&username="+Sessio n["usernameToEdit"].ToString();

                        Response.Redirect(url);

                  }

                  else //The user is new and he needs to be added into the database

                  {

                        userNotFoundPanel.Visible=true;

                        url="the user is new";

                  }





                  TextBox1.Text=url;

            }



            #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()

            {



            }

            #endregion

      }

}




Sadia Shoiab





Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit selected row of datagrid Mukesh Kumar ASP.NET 1.0 and 1.1 Basics 1 April 26th, 2007 03:54 PM
Edit Page via PHP Bourne PHP How-To 0 April 23rd, 2007 04:16 PM
paging to the page of selected item or row ysiline ASP.NET 1.0 and 1.1 Professional 1 July 13th, 2006 05:20 AM
Reloading page when option selected in dropdown chandrasekhar200 Beginning PHP 1 March 10th, 2006 04:52 AM
LoadControl Method and the Reference Page Direct. reckon ASP.NET 1.0 and 1.1 Professional 8 June 12th, 2004 09:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.