Cstom profile , non vengono salvati i profili nel database

mercoledì 06 febbraio 2013 - 11.46
Tag Elenco Tags  C#  |  .NET 4.0  |  Visual Studio 2010  |  SQL Server Express

first100 Profilo | Newbie

Salve a tutti,

Ho realizzato seguendo vari esempi un sistema di profili personalizzato che utilizza sql server , il progetto è web forms e il net framework è il 4.0, ho ridefinito la classe profilebase e aggiornato il web.config, il problema è che non riesco a salvare il profilo aggiornato o meglio lo salvo, ma nella tabella spnet_profile non viene scritto alcunchè e non ricevo alcun errore in esecuzione e compilazione, sto perdendoci la testa senza arrivare ad una conclusione , per favore potete aiutarmi?

Grazie
Metto qui il codice :

Web.config
Il codice sorgente non è stato renderizzato qui
perchè non c'è sufficiente spazio.
Clicca qui per visualizzarlo in una nuova finestra

Classe:
public class CustomUserProfile : ProfileBase { private string _Name; private string _Surname; private string _Address; private string _City; private string _CityCode; private DateTime _DateOfBirth; public static CustomUserProfile GetUserProfile(string username) { return Create(username) as CustomUserProfile; } public static CustomUserProfile GetUserProfile() { return Create(Membership.GetUser().UserName) as CustomUserProfile; } public string Name { get { return _Name;} set { _Name = value; } } public string Surname { get { return _Surname; } set { _Surname = value; } } public string Address { get { return _Address; } set { _Address = value; } } public string City { get { return _City; } set { _City = value; } } public string CityCode { get { return _CityCode; } set { _CityCode = value; } } public string DateOfBirth { get { return _DateOfBirth; } set { _DateOfBirth = value; } } }

e qui il webform dove si aggiorna il profilo :
public partial class UserProfilePanel : System.Web.UI.Page { MembershipUser currentUser; protected void Page_Load(object sender, EventArgs e) { currentUser = Membership.GetUser(); }
protected void lnkbtnOk_Click(object sender, EventArgs e) { currentUser = Membership.GetUser(); CustomUserProfile profile = CustomUserProfile.GetUserProfile(currentUser.UserName); profile.Name = txtNome.Text; profile.Surname = txtCognome.Text; profile.City = txtCitta.Text; profile.CityCode = txtCap.Text; // and here save profile.Save(); } }
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5