How to assign updated userName to HttpContext


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: How to assign updated userName to HttpContext

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Posts
    91

    How to assign updated userName to HttpContext

    Hi all,

    I am trying to create a website where people can change their userName from an update form. When user enter to the site it will grab the userName and role. These values will be assigned to the HttpContext.Current.user in Global.asax page. The problem is that whenever I update the userName to the database and then return to the defualt.aspx page it couldn't retrieve user's information anymore, because I have updated the userName in the database. The Global.asax page still uses the old Httpcontext.Current.User values to retrieve data from the database, where the userName doesn't exsit anymore.

    I would like to know how could I update my new userName to the HttpContext in order to retrieve data back to the web pages during run time?

    I have applied the following codes to Global.asax and update.aspx

    Global.asax (works fine in here)
    Code:
                        ' -- Add the roles to the User Principal
                        HttpContext.Current.User = New GenericPrincipal(User.Identity, roleListArray)

    update.aspx (doesn't seems like it's updating at all!!!)

    Code:
                        ' -- Add the roles to the User Principa
                        Dim MyIdentity As New GenericIdentity(txtEmail.Text)
                        HttpContext.Current.User = Nothing
                        HttpContext.Current.User = New GenericPrincipal(MyIdentity, roleListArray)
    Thanks

    Kero
    Last edited by kero; 09-15-2005 at 11:16 AM.

Similar Threads

  1. Login (Java Servlet/Database)
    By cappo in forum Java
    Replies: 1
    Last Post: 04-26-2005, 07:16 PM
  2. Replies: 0
    Last Post: 06-04-2002, 11:13 AM
  3. update query
    By an in forum Database
    Replies: 0
    Last Post: 05-08-2002, 02:12 PM
  4. Replies: 0
    Last Post: 05-07-2002, 09:34 PM
  5. Urgent!!! ADO Update conflict
    By Chillu in forum VB Classic
    Replies: 0
    Last Post: 07-14-2000, 01:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center