Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Showing posts with label C# Membership. Show all posts
Showing posts with label C# Membership. Show all posts

Tuesday, December 23, 2008

Get the ApplicationName for Stored Procedure Parameter

Sometimes the ApplicatonName is necessary for Membership stored procedures. You can access the ApplicationName as follows:

string appName = Membership.ApplicationName;


References: http://msdn.microsoft.com/en-us/library/system.web.security.membership.applicationname(VS.80).aspx

Use a CustomControl to Set UserId and Use as a DataBindable Property

Use a CustomControl (named MembershipUser) to Set UserId and Use as a DataBindable Property. Create a MembershipUser CustomControl that has a property named Value that can be DataBound. For example MembershipUser1.Value would fetch the userId:


[Browsable (true)]
public string Value
{
get
{
MembershipUser currentUser;
currentUser = Membership.GetUser();
if (currentUser == null)
return string.Empty;
return currentUser.ProviderUserKey.ToString();
}
}
Reference: This is from http://aspnet.4guysfromrolla.com/articles/110106-1.aspx