CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Creating A Default Page With Session Variables

Print topic Send  topic

Author Message
Suntower

Posts: 225
Posted: 09/01/2009, 9:28 AM

Hi,

We have an ASP 'classic; application which is used by -many- divisions in our company. Basically it's one app that switches at start-up between SQL Server databases. Each db is identical in structure.

So there are two session variables needed when the user hits the default page which set the dbconnection.

What I've been doing is using a simple HTML page as the default which simply redirects to the main ASP page with the proper parameters to establish the session variables. It uses the META tag HTTP-EQUIV REFRESH

I have always wanted to get rid of these 'dummy' HTML pages as I am told that HTTP-EQUIV should not be used. So how do I replace this?

1. Is there a way to establish these session variables in the header properties set by IIS?

2. Or is there another technique one could use?

I've asked this before and people tell me to create a unique CodeCharge page for each division but that's -dozens- of pages. There has to be a simpler method.

Ideas?

TIA,

---JC



_________________
---On a campaign for more examples and better docs!
View profile  Send private message
damian

Posts: 838
Posted: 09/01/2009, 3:31 PM

try this thread? http://forums.codecharge.com/posts.php?post_id=107619&s...witch+databases

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
Oper


Posts: 1195
Posted: 09/01/2009, 6:33 PM

This approach is what we use for the Dynamic Connection string

http://www.informatica.com.do/ContentComent.asp?cid=50

but the way you are doing work perfect.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
Suntower

Posts: 225
Posted: 09/02/2009, 9:56 AM

Quote damian:

The problem is that this is switching dbs -after- the person sees the login screen. What we need is a way to determine the db -before- the user logs in. In fact, it has to choose based on the home page of the login.

IOW:

egdrwebstore.com
superior-resourcewebstore.com
excelwebstore.com

...all resolve to the same web site. The ONLY difference is the port # after the IP address. What we need is a way for the opening Codecharge page to 'see' that port # and change db even before it serves up the first page (so the proper division logo can be displayed).

How I do this now is by having the default page for each 'site' be a dummy with an HTTP-EQUIV REFRESH CONTENT meta tag. I've been told these are no longer W3C compliant and would like to get rid of them. I've tried adding header variables at the server for each site but these are not readable as 'regular' response variables so that doesn't work.

Any other ideas besides hand coding a page for each site? (That would make deployment a nightmare as there are many, many divisions.)

Ideas?

---JC













_________________
---On a campaign for more examples and better docs!
View profile  Send private message
jjrjr1


Posts: 942
Posted: 09/02/2009, 10:23 AM

This might be overly simple but how about using subdomains for each division that would have a page that only would set a session variable for that particular division the re-direct to your normal site.

The normal site would use that session variable to select the proper database.

This way each divsion would use the entire site and each subdomain page would be identical only sending the appropriate sesson variable to the rest of the site.

Just a thought this might be too overlky simple or I might have missed what you are trying to do


_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
Suntower

Posts: 225
Posted: 09/02/2009, 10:31 AM

That's kinda what happens now. There is one IP and each site is referenced from a different port. The home page of each simply redirects to the same codecharge home page, but with a server variable which sets the database. What I don't

welcome-01.htm ---division 1
welcome-02.htm ---division 2

..etc...

The ONLY difference between each 'welcome' page is that each passes a different variable on to the codecharge main page.

What I don't get is why each 'welcome' page is creating a frame.

How would your idea be different?

TIA,

---JC

Quote jjrjr1:
This might be overly simple but how about using subdomains for each division that would have a page that only would set a session variable for that particular division the re-direct to your normal site.

The normal site would use that session variable to select the proper database.

This way each divsion would use the entire site and each subdomain page would be identical only sending the appropriate sesson variable to the rest of the site.

Just a thought this might be too overlky simple or I might have missed what you are trying to do



_________________
---On a campaign for more examples and better docs!
View profile  Send private message
jjrjr1


Posts: 942
Posted: 09/02/2009, 12:57 PM

Hi

I guess I am not sure what the issue is here. One issue of frame creation by the server needs to check the server configuration and ensure that it is not doing frame forwarding.

Also by redirecting in the PHP code rather that in HTML (opps this is ASP So however you would simulate a redirect from ASP. I am sure you can set headers and exit in ASP also.) would take the server basicxally out of the equation.

EG:

each division has a subdomain with just one php file in it as index.php for that particular division.

It would do these basic functions

1. Get the subdomain name
2. Set That Subdomain name as a session variable called maybe division
3. Set the headers to cause a redirect via PHP headers to the main site
4. exit

Now all the main site has to do is get the session variable division and set the database table accordingly.

This way you do not have the HTML doing the redirect, dealing with server ports, and the osibility of the server modifying your HTML to use a frame.

This is just a guess, but might be worth trying since the path you are trying now is giving fits..

Let me know what works, I would be very interested in hearing what fixes this problem.

John

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
jjrjr1


Posts: 942
Posted: 09/02/2009, 12:59 PM

BTW. I think this method would not require custom pages for each division. The same index.php page would work in all subdomain roots since it would send the subdomain name as the session variable for the main page to determine division. Soo. you use the same page for all subdomain's index.php

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
Suntower

Posts: 225
Posted: 09/02/2009, 2:17 PM

How do I test for "frame forwarding"? Not familiar with this concept. It's IIS 5.0.

I tested the 'welcome' page to see how it would work redirecting to a static page (not codecharge) and it created the frame again so I guess that means it's the server, right?

TIA,

---JC

Quote jjrjr1:
Hi

I guess I am not sure what the issue is here. One issue of frame creation by the server needs to check the server configuration and ensure that it is not doing frame forwarding.

Also by redirecting in the PHP code rather that in HTML (opps this is ASP So however you would simulate a redirect from ASP. I am sure you can set headers and exit in ASP also.) would take the server basicxally out of the equation.

EG:

each division has a subdomain with just one php file in it as index.php for that particular division.

It would do these basic functions

1. Get the subdomain name
2. Set That Subdomain name as a session variable called maybe division
3. Set the headers to cause a redirect via PHP headers to the main site
4. exit

Now all the main site has to do is get the session variable division and set the database table accordingly.

This way you do not have the HTML doing the redirect, dealing with server ports, and the osibility of the server modifying your HTML to use a frame.

This is just a guess, but might be worth trying since the path you are trying now is giving fits..

Let me know what works, I would be very interested in hearing what fixes this problem.

John


_________________
---On a campaign for more examples and better docs!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.