Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2004, 01:52 PM
Registered User
 
Join Date: Jun 2004
Location: Orlando, Fl, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Session Variable

I need to be able to create a variable from a QueryString name:value pair which can be called from subsequent pages. The first page loaded has a name:value attached, provides for the user to "login", checks the input against an Access database field and if not found opens a page to "create a login" which then opens an "action file. The subsequent pages are being opened from a "Form Action" as opposed to a Server.Execute stmt.... thus focus is shifted from page to page. After creating a "login account" I want the user to be able to complete a download using the original Request.QueryString("file") reference.

Is there a way to assign the value to a variable that will survive from page to page? Any other suggestions? Help is much appreciated.

John McDowell
mcdowell@att.net
  #2 (permalink)  
Old June 19th, 2004, 02:47 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can use that as a hidden field in the form of every page and on submit it would be avaliable to the next page, and carry that on for all those pages. This way you got to code for the hidden variable to be passed on from page to page.

May be you can assign that to session variable and can take that at any page you want. This way you got to be careful that if the hit to web server is going to be huge, then session variables have its hand slow down the web server.

I dont think query string can be the right solution, if you dont want to reveal its value to the user, as it is visible in along with the URL. Then querystring won't suit that.

Hope that explains.
Cheers!

_________________________
-Vijay G
Strive for Perfection
  #3 (permalink)  
Old June 19th, 2004, 06:21 PM
Registered User
 
Join Date: Jun 2004
Location: Orlando, Fl, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vijay,

I appreciate your response. Let me list the sequence to better define the problem.

I wish to send a "link" to someone to download a file from our webserver like http://www.companyname.com/login.asp?file=filename.zip

The login.asp file has a form to enter their email address which is then checked against a database... if they are a first time visitor I have a hyperlink to another page to "create_a_login_acct.asp" which contains a multi input form designed to gather and store all their company information... the "Form Action" sector calls yet another page "create_a_login_acct_action.asp which posts the data to the database.

After the database has been updated I would like to complete the download from the original page "login.asp" by providing a hyperlink to "/download_directory/'Request.QueryString("file")'" which should complete the process. I need to maintain in memory the name of the file intended to be downloaded through these various page changes.

Basically I wish to channel the link for the download file through a process of having the user "login" before downloading or if it is a new user, have them "create a login account" return to login and finally be able to download the file;

Any suggestions on how to accomplish this?

John McDowell
mcdowell@att.net
  #4 (permalink)  
Old June 19th, 2004, 06:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi McDowell,

As there are not too many pages involved in it, I would suggest you to go with a hidden form field for this than using a session variable.

So when you send this link to someone
http://www.companyname.com/login.asp?file=filename.zip

When the person whom you send this link clicks on the link, that shows him the login.asp with file=filename.zip as querystring.

1) You can store that in a hidden field of the form on login.asp by

Code:
<input type="text" name="txtDownloadFile" value="<%=Request.Querstring("file")%>">
2) Then once the user fills the email Id on this page, say it submits to "CheckEmail.asp" where you check for email existence in the DB.

Code:
''' your code for checking email address in DB.
IF <Emailexists> then
    Response.Redirect("download.asp?file=" & Request.Form("txtDownloadFile"))
ELSE
    Response.Redirect("Createlogin.asp?file=" & Request.Form("txtDownloadFile"))
END IF
3) Case 1 - Email exists
Now within your "download.asp" you can fetch the FILENAME from the querystring as done in "login.asp" and provide a link to that file. (May be you can have a fixed folder called "C:\Download" to have those downloadable files stored into. And use that fixed path while providing the link for download.)

4) Case 2 - Create login
On Createlogin.asp, you can fetch the Querystring and store it into another hidden field, and let the user input the details asked in that page, and on submit (say "SaveData.asp") store the data into DB and fetch the FILENAME from hidden field and redirect to "download.asp?file=<HIDDENFIELDVALUE>" as said above in CHECKEMAIL.asp in the IF part.

Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
  #5 (permalink)  
Old June 19th, 2004, 07:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Forgot to mention this.

For the steps mentioned in my previous post, you don't have to provide a "create login" link on the login.asp page. Anyways, if email address doesn't exist in DB, that would be redirected to "createlogin.asp" as per the code in STEP 2 (ELSE part).

Cheers!

_________________________
-Vijay G
Strive for Perfection
  #6 (permalink)  
Old June 20th, 2004, 05:47 AM
Registered User
 
Join Date: Jun 2004
Location: Orlando, Fl, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vijay,

Thank you for you response. I clearly understand the process now and deeply appreciate your assistance. I have sent you a separate email with additional info. Again... thank you for the help.


John McDowell
mcdowell@att.net
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
session and variable... badboy1 ASP.NET 3.5 Basics 1 August 3rd, 2008 09:14 AM
Session Variable youyou_hym Dreamweaver (all versions) 4 January 20th, 2005 11:48 AM
Session variable anuradha80 General .NET 3 November 4th, 2004 12:39 AM
Session variable mrideout BOOK: Beginning ASP.NET 1.0 1 August 12th, 2004 07:01 PM



All times are GMT -4. The time now is 09:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.