This topic is locked

Login redirect

3/5/2009 03:07:06
ASPRunnerPro General questions
G
guroos author

The client would like different groups to go to different pages after login instead of the default menu page.

Is it possible for one group to go direct to edit (this group can only see their own record) and all other groups to go directly to a list page?

J
Jane 3/5/2009

Hi,
use AfterSuccessfulLogin event and Redirect to another page action on the Events tab for this purpose.

Here is a sample:

if Session("GroupID")="group1"

Response.Redirect "page1_list.asp"

end if

G
guroos author 3/5/2009

Hi,

use AfterSuccessfulLogin event and Redirect to another page action on the Events tab for this purpose.

Here is a sample:


Thank you for your quick response.

The code as is (with me replacing 'group1', etc ) returns an http 500 error.
However if I just do the response .redirect line it works, any ideas?

J
Jane 3/6/2009

Sorry for my fault.

Here is the correct code:

if Session("GroupID")="group1"then

Response.Redirect "page1_list.asp"

end if

G
guroos author 3/6/2009

Sorry for my fault.

Here is the correct code:


DOH! I shudda seen that , thanks.
OK it works when directing groups to a list page but I have one group who can only see their own data & I would like them to go to the edit view, I expect it will be something like:

Response.Redirect "t_Exhibitors_e_edit.asp?edit1=companyid&edit2=standnumber"

But I can't get it right, is this possible?
Last but not least the above method does not seem to work for the 'Guest' login - list view is ok for them.

J
Jane 3/6/2009

Hi,
you need to select companyid and standnumber from table based on the current group manually.

Here is just a sample:

if Session("GroupID")="group1" then

str = "select companyid, standnumber from t_Exhibitors_e where groupID='" & Session("GroupID") & "'"

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

Response.Redirect t_Exhibitors_e_edit.asp?editid1=" & rstmp("companyid") & "&editid2=" & rstmp("standnumber")

rstmp.close

set rstmp=nothing

end if