asp.net mvc user register exception on another computer

274 views Asked by At

I have developed an asp.net mvc web application with the functionality of user log in and register. It works fine. But now I have to work on another PC instead of previous one. When I debug my application on my new machine, It through an exception while user registering.

public ActionResult Register( RegisterModel model ) {
        if ( ModelState.IsValid ) {
            // Attempt to register the user
            try {
                WebSecurity.CreateUserAndAccount( model.UserName, model.Password );
                WebSecurity.Login( model.UserName, model.Password );
                return RedirectToAction( "Index", "Home" );
            } catch ( MembershipCreateUserException e ) {
                ModelState.AddModelError( "", ErrorCodeToString( e.StatusCode ) );
            }
        }

        // If we got this far, something failed, redisplay form
        return View( model );
    }

The same application works fine on the previous machine but not on this machine.

The exception is in German Language. English is here.

The value NULL can be used in the 'Firma' column' aspnet-ViewExampleDatabase4-20121207182953.dbo.UserProfile 'table can not be inserted. The column does not allow NULL values. Error in INSERT.

The statement has been terminated.

Complete Error Description:

Server Error in '/' Application.
Der Wert NULL kann in die 'Firma'-Spalte, 'aspnet-      
ViewExampleDatabase4-20121207182953.dbo.UserProfile'-Tabelle nicht eingefügt werden.  
Die Spalte lässt NULL-Werte nicht zu. Fehler bei INSERT.
Die Anweisung wurde beendet.

Description: An unhandled exception occurred during the execution of the current web  
request. Please review the stack trace for more information about the error and where  
it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Der Wert NULL kann in die    
'Firma'-Spalte, 'aspnet-ViewExampleDatabase4-20121207182953.dbo.UserProfile'-Tabelle  
nicht eingefügt werden. Die Spalte lässt NULL-Werte nicht zu. Fehler bei INSERT.
Die Anweisung wurde beendet.

Source Error:


Line 75:                 // Attempt to register the user
Line 76:                 try {
Line 77:                     WebSecurity.CreateUserAndAccount( model.UserName,    
model.Password );
Line 78:                     WebSecurity.Login( model.UserName, model.Password );
Line 79:                     return RedirectToAction( "Index", "Home" );


Source File: D:\ymahmood\Desktop\WebFrontEnd_13112013\Controllers\AccountController.cs
Line: 77

Stack Trace:


[SqlException (0x80131904): Der Wert NULL kann in die 'Firma'-Spalte, 'aspnet-     
ViewExampleDatabase4-20121207182953.dbo.UserProfile'-Tabelle nicht eingefügt werden. 
Die Spalte lässt NULL-Werte nicht zu. Fehler bei INSERT.
Die Anweisung wurde beendet.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean   
breakConnection, Action`1 wrapCloseInAction) +1767866
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean 
breakConnection, Action`1 wrapCloseInAction) +5352418
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject  
stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, 
SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,    
TdsParserStateObject stateObj, Boolean& dataReady) +1691
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior 
runBehavior, String resetOptionsString) +269
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, 
RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task&  
task, Boolean asyncWrite, SqlDataReader ds) +1406
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, 
RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1  
completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1  
completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)  
+205
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +160
WebMatrix.Data.Database.Execute(String commandText, Object[] args) +116
WebMatrix.WebData.DatabaseWrapper.Execute(String commandText, Object[] parameters) +14
WebMatrix.WebData.SimpleMembershipProvider.CreateUserRow(IDatabase db, String  
userName, IDictionary`2 values) +757
WebMatrix.WebData.SimpleMembershipProvider.CreateUserAndAccount(String userName,  
String password, Boolean requireConfirmation, IDictionary`2 values) +64
WebMatrix.WebData.WebSecurity.CreateUserAndAccount(String userName, String password, 
Object propertyValues, Boolean requireConfirmationToken) +72
ViewExampleDatabase4.Controllers.AccountController.Register(RegisterModel model) in  
D:\ymahmood\Desktop\WebFrontEnd_13112013\Controllers\AccountController.cs:77
lambda_method(Closure , ControllerBase , Object[] ) +180
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[]  
parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext,  
IDictionary`2 parameters) +211
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext  
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41()  
+28
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult  
asyncResult) +48
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()  
+57
System.Web.Mvc.Async.<>c__DisplayClass4f. 
<InvokeActionMethodFilterAsynchronously>b__49() +223
System.Web.Mvc.Async.<>c__DisplayClass4f. 
<InvokeActionMethodFilterAsynchronously>b__49() +223
System.Web.Mvc.Async.<>c__DisplayClass37.
<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57


 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters
 (IAsyncResult asyncResult) +48
 System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult   
 asyncResult) +102
 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult     
asyncResult) +43
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)  
+14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)  
+25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult  
 result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514812
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&  
completedSynchronously) +155


 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET      
 Version:4.0.30319.18408 
0

There are 0 answers