Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 1st, 2004, 02:03 PM
Authorized User
 
Join Date: Jul 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing Session Variables to the Next Page

Hi All,

I'm not sure if this is a "ASP Professional" Question, so here it goes. I was asked to redirect this post to an ASP.NET Forum cause I posted to the ASP Database before. So I'm posting here and also at ASP.NET 1.1 because I don't know where to post this one:

I need some help passing session variables from my login page to the next page. This is what I am trying to do:

- When users of the Human Resources Department access the next few pages via a login page, I want them to only see a button that is for Human Resources.
- Conversely, when users of the Information Services Department access the next few pages via a login page, I want them to only see a button that is for Information Services.

The order of the pages is as follows:
1.) Login Page
2.) Default Thank You Page (telling users that the login was successful)
3.) User Interface Page (where the user, depending on which department they are from, can only view specific buttons that pertain to their department).

I thought I was doing it correctly with the following code for the 'User Interface Page':

<MM:If runat="server"
Expression='<%#(session("sessDepartment")="HR")%>' >
<ContentsTemplate>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="108" height="46">
                      <param name="BGCOLOR" value="">
                      <param name="movie" value="HR Button (Dept Module).swf">
                      <param name="quality" value="high">
                      <embed src="HR Button (Dept Module).swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="108" height="46" ></embed>
                    </object>
</ContentsTemplate>
</MM:If>

On the page before (the 'Default Page'), I have the following script:

<script runat="server" language="VB">
Sub Page_Load()
Session("sessDepartment")=Request("hfDepartment")
Session("sessEditPages")=Request("hfEditPages")
End Sub
</script>

On the page before that, the 'Login Page', I have the following code which authenticates the Username. In my Access Database, I have two tables that are linked which should pull the Department that the username is from. Here is the Login Page code:
<%
if dsLogin.RecordCount > 0 then
Session("sessUsername") = Request.Form("tfUsername")
FormsAuthentication.RedirectFromLoginPage("tfUsern ame.value", true)
else if ((Request.Form("tfUsername"))) <> Nothing _
OR ((Request.Form("tfPassword"))) <> Nothing
Response.Write("Login Failed. Please Try Again.")
end if
%>

Any thoughts to why this is not working? Oh yeah, I'm using Dreamweaver as an application.
Thanks,
Jim




 
Old August 1st, 2004, 06:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

http://p2p.wrox.com/topic.asp?TOPIC_ID=16950





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing session variables from login page. captainzorro Classic ASP Components 1 April 23rd, 2008 11:54 PM
Passing session variables from IIs to Tomcat aman thaper Internet Information Services 0 November 14th, 2006 09:34 AM
passing variables through session dmlocke Beginning PHP 4 May 4th, 2005 10:35 PM
Passing Session Variables to the Next Page [email protected] Classic ASP Databases 2 August 1st, 2004 01:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.