Developer forum

Forum » Development » User class - DW 8.1.1.7

User class - DW 8.1.1.7

Vilius Janulis
Reply

Hi,

I have a custom modules that creates user in DW. It was working in older DW version, but when updated it started to through and error on user.Save() method.

Object reference not set to an instance of an object.  at Dynamicweb.Modules.UserManagement.User.get_Current(PagePermissionLevels level) at Dynamicweb.Modules.UserManagement.User.Save()   at CustomModules.CustomModules.CreateLogins.ProcessRequest(HttpContext context)"

it still saves the user as before but it throughs this error too. Was there some changes in the user class in the last releases (since the 100% same code worked before without them)? Are there some new mandatory user fields ?

Wont post the long user creation code, but i instantiate the user , set username, password, add it to group. And try to save it.

Anyone can help ? :)

 

Thanks

 


Replies

 
Vilius Janulis
Reply

P.s. maybe it is something with my current dll's since if i try to delete a user from backend (just simple right mouse on user and delete) or create user from backend (create user, enter fields, press save) i also get and error : 

Server Error in '/' Application.

Incorrect syntax near '44445'.
Incorrect syntax near '44445'.

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: Incorrect syntax near '44445'.
Incorrect syntax near '44445'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[SqlException (0x80131904): Incorrect syntax near '44445'.
Incorrect syntax near '44445'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +388
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +688
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4403
   System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +82
   System.Data.SqlClient.SqlDataReader.get_MetaData() +135
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6665229
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite) +6667096
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +577
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +107
   System.Data.SqlClient.SqlCommand.ExecuteScalar() +270
   Dynamicweb.Database.ExecuteScalar(String sql, String database, IDbConnection connection) +243
   Dynamicweb.Modules.Common.DbObject.Delete(Int32 id) +103
   Dynamicweb.Modules.UserManagement.User.Delete() +136
   Dynamicweb.Admin.UserManagement.ListUsers.Delete() +364
   Dynamicweb.Admin.UserManagement.ListUsers.Page_Load(Object sender, EventArgs e) +234
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18010

 

And this one should not have nothing to do with custom module, since my custom module is just normal custom paragraph module witch is not run on page load and etc, especially in backend .

 

 

Would appreciate some ideas :)

 
Nicolai Høeg Pedersen
Reply

You are running SQL-Server 2012...

 

See this thread:

http://developer.dynamicweb-cms.com/forum.aspx?PID=48&ThreadID=31275

 
Vilius Janulis
Reply

Hi Nicolai,

 

Helped with second problem :)

But the first one is still there :)

 

Thanks for the help by the way.

 
Kim Sørensen
Reply
This post has been marked as an answer

I got the same error a few days ago, when i tried to save a user from a generic handler, extending it with : IRequiresSessionState solved it for me.

 

hope it helps.

Votes for this answer: 1
 
Vilius Janulis
Reply

Help for me too.

 

Thanks Kim and Nicolai.

 

You must be logged in to post in the forum