View Single Post
  #3 (permalink)  
Old October 5th, 2006, 04:04 AM
hcusto hcusto is offline
Authorized User
 
Join Date: Aug 2006
Location: Mostar, HNK, Bosnia and Herzegovina.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hcusto
Default

First include "System.Web.Security" namespace

Code:
using System.Web.Security;
then in your method (function) where you want to get user id write:

 Membership.GetUser().ProviderUserKey;

if you want to add it to the string you must convert it to string but first check if the user id logged in
Code:
string userID;

if (User.Identity.IsAuthenticated)
{
      userID = Membership.GetUser().ProviderUserKey.ToString();
}
Hope that this helps,
Haris