Developer forum

Forum » Development » Pageview in pop up pages?

Pageview in pop up pages?


Reply

I have pop up page (a regular asp.net page) that allows users to report inappropriate forum posts in our custom forum module.

 

I have to check whether the user is logged in before submitting the form and i wanted to know if there is any possibility in DW to get the current uer logged in when not in the pageview context?

 

I tried to call the Dynamicweb.Frontend.PageView.Current() but it is null.

 

- Sune

 

 


Replies

 
Reply
sune@fonqi.dk wrote:

I have pop up page (a regular asp.net page) that allows users to report inappropriate forum posts in our custom forum module.

 

I have to check whether the user is logged in before submitting the form and i wanted to know if there is any possibility in DW to get the current uer logged in when not in the pageview context?

 

I tried to call the Dynamicweb.Frontend.PageView.Current() but it is null.

 

- Sune

 

 

Hi Sune
 

 

The PageView is initialized on each request of a DW page, so you will not hav access to it in a page that is not run throug the Dynamic framework.

 

What you can do is having a look at all the Session variables, there is a lot dealing with an Extranet user. fx.

if(!string.IsNullOrEmpty(Session["DW_extranet_username"].ToString())){

// user is logged in

}

else{

// user is NOT logged in

}

 

 

/Kenneth

 
Nicolai Høeg Pedersen
Reply

Hi Sune

 

Do like this in your pop-up:

 

Dim CurrentUser As New Dynamicweb.Frontend.Extranet
If CurrentUser.LoggedIn Then
 Response.Write(CurrentUser.UserName)
End If

 

or

 

Dynamicweb.Frontend.Extranet CurrentUser = new Dynamicweb.Frontend.Extranet();
    if (CurrentUser.LoggedIn) {
        Response.Write(CurrentUser.UserName);
    }

 

 
Reply
np wrote:

Hi Sune

 

Do like this in your pop-up:

 

Dim CurrentUser As New Dynamicweb.Frontend.Extranet
If CurrentUser.LoggedIn Then
 Response.Write(CurrentUser.UserName)
End If

 

or

 

Dynamicweb.Frontend.Extranet CurrentUser = new Dynamicweb.Frontend.Extranet();
    if (CurrentUser.LoggedIn) {
        Response.Write(CurrentUser.UserName);
    }

Thanks, that makes things a lot easier.

On that note; what is the smoothest way to instantiate an AccessUserClass?

I have my own function:

 

public AccessUserClass GetUser(int userID)
{
    try

    {

        DataRow d = Database.getDataSet("SELECT * FROM AccessUser WHERE AccessUserID = " +         userID, "Access.mdb").Tables[0].Rows[0];
                return new AccessUserClass(d);
    }
     catch{return null;}
 }

 

Does DW have a similar function to get an accessUser by id or is the new AccessUserClass(Datarow) the way to do it?

 

- Sune

 
Nicolai Høeg Pedersen
Reply

You should use ExtranetExtended.User instead:

 

Dim usr As Dynamicweb.ExtranetExtended.User = New Dynamicweb.ExtranetExtended.User(1)
usr.Name = "Some name"
usr.Save()

 

 

You must be logged in to post in the forum