cancel
Showing results for 
Search instead for 
Did you mean: 

How to log user to Netpoint thru c#

Former Member
0 Kudos

I have replaced the CreateAccount.aspx with more sofiticated version.

1) Thru c#, I would like to LOG the user automatically at the end of the account creation

I coulld not find anything in the API do do this.

2) I also need a way to determine if a user is logged in or not thru c#

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Francois,

Not sure what yo meant by Log the user - did you mean log them in automatically or did you mean create some kind of a log of their account creation?

As regards the second query, you can check if the current user is logged in like this:


NPBasePage p = (NPBasePage) Page;
if  (p.UserID=="")
{
   //user is not logged in
}
else
{
   //user is logged in
}

Former Member
0 Kudos

For the login I need a way to log the user to netpoint as if the user had manually entered is UserID and Password.

Thanks

Former Member
0 Kudos

Hi Francois,

Maybe something like this (after you have created and saved the user, etc, using the appropriate API calls and asusming your user variable is called newUser):

NPBase Page p = (NPBasePage) Page;

p.Login(newUser.UserID, newUser.AccountID);

Response.Redirect (wherever you want to go, perhaps the myaccount.aspx page for example)

let us know how you get on.

Former Member
0 Kudos

NPBasePage ???

Where is this class defined ?

I already have a reference to Netpoint.API but NPBasePage IS NOT in that Namespace.

In Netpoint.API there is NPBase but not NPBasePage !

Former Member
0 Kudos

Hi Francois,

just to elaborate a bit on that last point;

To inherit from NPBasePage you should have this in your <@Page> directive:

inherits = "netpoint.classes.NPBasePage"

and then have a separate @import

<%Import namespace = "netpoint.classes"%> to reference the namespace.

NPBase page is derived from the .NET Page object but includes also stuff like the plugins to display on the page, as well as the current UserID, a Catalog object representing the Catalog for the current user, and all sorts of other useful stuff for netpoint pages.

If you are using pages with codebehind (not recommended) then instead of modifying the @Page directive you should have a

using netpoint.classes; line at the top of your codebehind file, and make sure that the declaration of your page class derives from NPBasePage

i.e

public partial class MyPage: NPBasePage

{

}

Answers (1)

Answers (1)

Former Member
0 Kudos

For the code that Stephen suggested the page must inherit from NPBasePage, or the control must reside on a page that has inherited NPBasePage.

NPBasePage is parent page (UI) for most of the pages in Web tools.

If you are building a new custom page it must inherit NPBasePage.