Developer forum

Forum » Development » ExtranetLogin error in ASHX file

ExtranetLogin error in ASHX file

Erik Pettersson
Reply

 I have created one hanler "autologin.ashx". In the handler i need extranet login. For that i have used the following code. 

Dynamicweb.Modules.UserManagement.User user = Dynamicweb.Modules.UserManagement.User.Authenticate("FRANKMARCKSCHEFFEL@FBAUFZUEGE.DE", "fep4jewn", Dynamicweb.Modules.UserManagement.User.PermissionLevels.Frontend);
                try
                {                  
                    Dynamicweb.Security security = new Dynamicweb.Security();                    
                    security.ExtranetLogin(user.UserName, user.Password);
                }

But an error is getting "Object reference not set to an instance of an object. Void set_Current(Dynamicweb.Modules.UserManagement.PagePermissionLevels, Dynamicweb.Modules.UserManagement.User) Dynamicweb at Dynamicweb.Modules.UserManagement.User.set_Current(PagePermissionLevels level, User value) at Dynamicweb.Security.ExtranetLogin(String username, String password, Boolean onlyActive) "

 

Anyone please help to resolve this problem. Im stuck with it.

 

Autologin.ashx_file.JPG ErrorAtologin.JPG

Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Erik,

My guess is that your handler needs to implement IRequiresSessionState  or IReadOnlySessionState as described here: http://www.hanselman.com/blog/GettingSessionStateInHttpHandlersASHXFiles.aspx

Cheers,

Imar

 
Erik Pettersson
Reply

Hi Imar ,

I have added "IRequiresSessionState". Now it is working fine. Great help... Thanks :)  Cheers

 

 

You must be logged in to post in the forum