Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > BOOK: Silverlight 4 Problem - Design - Solution
|
BOOK: Silverlight 4 Problem - Design - Solution
This is the forum to discuss the Wrox book Silverlight 4 Problem - Design - Solution by Nick Lecrenski; ISBN: 9780470534045
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Silverlight 4 Problem - Design - Solution 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 October 30th, 2010, 07:53 PM
Registered User
 
Join Date: Oct 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Duplicate email on sign up - domain exception not passed to silverlight

I am working through the Silverlight 4 problem design solution book. I created the sign up form but in a child window instead of a separate page. It all works except when I attempt to sign up again with the same email address. I was expecting the results.haserror to return "Duplicate email" exception but it seems that silverlight just swallows that error. During debugging it breaks at a domain exception. Without debugging enabled it simply shows no error message.

Here is the createusercallback from the book... with some added try catch blocks

private void CreateUserCallback( InvokeOperation result)
{


if (!result.HasError)
{
// After successfully creating a new account you want the user to automatically be
// logged in and redirected to the Dashboard. By firing this custom SignupComplete
// event the parent control can perform the login operation when the account has been
// created.
try
{

if (SignupComplete != null)
{
SignupComplete(this, new SignupEventArgs(result.UserState as tuser));
}
else
{


}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(), "Registration Error Details", MessageBoxButton.OK);

}

///this.DialogResult = true;
}
else
{
MessageBox.Show(result.Error.Message.ToString(), "Registration Error Details", MessageBoxButton.OK);
result.MarkErrorAsHandled();
}
}


The domain service using a custom membership provider call
[EnableClientAccess()]
public class TUserService : LinqToSqlDomainService<UsersDataContext>
{

private NG.Web.Providers.MembershipProvider provider = Membership.Provider as NG.Web.Providers.MembershipProvider;

[Invoke]
public void CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer)
{
MembershipCreateStatus status;
tuser createUser = provider.CreateUser(username, password, email, passwordQuestion, passwordAnswer,
true, null, out status) as tuser;
if (status != MembershipCreateStatus.Success)
{
throw new DomainException(status.ToString());
}

}

public tuser GetUser(string email)
{
return provider.GetUser(email, true) as tuser;
}



}

I probably haven't shown enough info or the correct info... Any ideas?
 
Old November 1st, 2010, 02:04 PM
Registered User
 
Join Date: Oct 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default More info

I am now using a return function as follows... Still not working though!

[Invoke]
public CreateUserStatus CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer)
{
MembershipCreateStatus status;
tuser createUser = provider.CreateUser(username, password, email, passwordQuestion, passwordAnswer, true, null, out status) as tuser;
if (status != MembershipCreateStatus.Success)
{
return TUserService.ConvertStatus(status);
//throw new DomainException(status.ToString());
}
else
{
return TUserService.ConvertStatus(status);
}

}
 
Old November 1st, 2010, 07:03 PM
Authorized User
 
Join Date: Sep 2009
Posts: 34
Thanks: 4
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by Dannyd5 View Post
I am now using a return function as follows... Still not working though!

[Invoke]
public CreateUserStatus CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer)
{
MembershipCreateStatus status;
tuser createUser = provider.CreateUser(username, password, email, passwordQuestion, passwordAnswer, true, null, out status) as tuser;
if (status != MembershipCreateStatus.Success)
{
return TUserService.ConvertStatus(status);
//throw new DomainException(status.ToString());
}
else
{
return TUserService.ConvertStatus(status);
}

}
I think, the error is in the client side code.
In the latest server side code You return the same object independently of the status value.
Try to omit the Try Catch block in the client code.
Gabor





Similar Threads
Thread Thread Starter Forum Replies Last Post
WHERE {field name passed as a parameter} 'contains' {value passed as a parameter} cuddling101 BOOK: Beginning ASP.NET 4 : in C# and VB 2 August 25th, 2010 08:52 AM
Exception Report - Show Only Duplicate Records amphion SQL Server 2000 1 April 6th, 2007 04:33 AM
Same pages for sub domain from main domain vivek_inos ASP.NET 1.0 and 1.1 Professional 1 February 13th, 2007 10:15 AM
The little "plus" sign janise Access 8 January 6th, 2005 10:10 AM





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