Developer forum

Forum » Development » Custom user login

Custom user login

Mikkel Høst
Reply

Hi guys.

Anyone know why doesn't this work ?

 public class test : IHttpHandler, System.Web.SessionState.IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            Dynamicweb.Security sec = new Dynamicweb.Security();            
            sec.ExtranetLogin("test", "test"); 

            context.Response.Write("ok");
        }    
    }

The stack tells me it fails at

Dynamicweb.Security.ExtranetLogin(String username, String password, Boolean onlyActive, Boolean impersonateUser, Int32 impersonateUserID, Boolean loginIfPwdEncrypted)

with a Object reference not set to an instance of an object.

I have read about others having the problem but no solution

Info : 

1. User passwords is NOT encrypted.

2. DW : 8.7.2.2

A related question. I was trying to figure out what line it failed on in Dynmiacweb.dll, so i downloaded the symbols and put them in /bin. But i can't seem to get more detailed information about the error. Anyone know how to do this in DW / Visual stuido so we can get the exact line errors occour?


   


Replies

 
Mikkel Høst
Reply

Found the solution. There is some sort of bug. If you do this before login

 var pv = Dynamicweb.Frontend.PageView.GetPageview();

it will not fail.

 
Nicolai Høeg Pedersen
Reply

Hi Mikkel

Login requires the context of a pageview to know how to handle the login of the user, and you are in the context of a httphandler that does not have that. So your solution to create your own instance of the pageview is a solution.

BR Nicolai

 
Mikkel Høst
Reply

Hi Nicolai.

Thanks.

How about

 A related question. I was trying to figure out what line it failed on in Dynmiacweb.dll, so i downloaded the symbols and put them in /bin. But i can't seem to get more detailed information about the error. Anyone know how to do this in DW / Visual stuido so we can get the exact line errors occour? 

Is this possibel?

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

The symbols are available as a help in case you get an exception. The stack trace without the symbols loaded will show you method calls and stack offsets but if you load the symbols, you'll get the actual line number.

It's not possible to debug into Dynamicweb properly, like you're used to with your own code. If you had the original code files, you could debug into the Dynamicweb assembly, but you'd be limited in what you can inspect as all assemblies are compiled using the Release configuration. It might be able to help you though, so if you don't already have it, you can request access to our code base here: http://developer.dynamicweb.com/downloads/source-code.aspx

You can also try to use reflection tools like .NET Reflector or dotPeek to reflect the assembly. They can also generate a symbol file with reverse-engineered code files that you can use to debug. This might also help you in case the above mentioned solution fails. Please note that the code files generated by these tools are not the original code files and cannot be used to determine the original line number by themselves, but they might be able to point the the code logic that fails.

Debugging with code base access is by far the preferred option.

- Jeppe

 
Nicolai Høeg Pedersen
Reply

Hi Mikkel

Also take a look at this article: https://blogs.msdn.microsoft.com/visualstudioalm/2015/01/05/understanding-symbol-files-and-visual-studios-symbol-settings/

BR Nicolai

 
Mikkel Høst
Reply

Thanks guys.

I know and use all the tools. Just couldn't get the line numbers when i had the symbols files from you guys in my bin folder. Just wanted to know if i had to do anything else than putting the symbol files in the bin to make it work.

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> Login requires the context of a pageview to know how to handle the login of the user

Any chance you can hide this logic behind some helper method or provider in the product? Would be nice to have a simple way to authenticate externally without having to know the intrinsics.

Cheers,

Imar

 

You must be logged in to post in the forum