ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 1st, 2003, 11:34 PM
Buraque Buraque is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Shimonoseki / JAPAN
Posts: 58 Buraque User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 4 sec
Reputation Power: 6
inserting a querystring variable into <!--include--> URL parth.. kinda tricky?

This is not working
Code:
activelang=Request.QueryString("lang")
.
some code
.
Response.Write " <!--#include virtual='/SIFS/" & activelang & "/welcome.txt' -->"


this is not working too...
Code:
activelang=Request.QueryString("lang")
.
some code
.
<!--#include virtual='/SIFS/<%= activelang %>/welcome.txt' -->

Is there any trick will do the job ?
Thanks for any replies...
__________________
Sweet smell of a great sorrow lies over the land. Plumes of smoke rise, merge into the leaden sky. A man lies and dreams of green fields and rivers, but awakes to a morning with no reason for waking. He's haunted by the memory of lost paradise. In his youth or dream, he can't be precise. He's chained forever to a world that's departed. It's not enough, it's not enough.
Gilmour

Reply With Quote
  #2  
Old May 2nd, 2003, 10:20 AM
defjamninja defjamninja is offline
Overly white
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Fresno, CA
Posts: 83 defjamninja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I think the problem is that all the include files are processed first then all the code is executed. So I bet that your include is just being writtten to the html document and is not being processed.

I did some quick research and came up with an idea for you. I've never tried this and it only works in ASP 3.0 but I think you need to use the Response.Execute() function. If I understand correctly <!-- #include... --> is the old way of doing things. You should now be using Response.Execute() to use include files. I've never used the Execute method or tried to create dynamic inlcude files but here is my stab at it anyway.

Code:
activelang=Request.QueryString("lang")
.
some code
.
Response.Execute("/SIFS/" & activelang & "/welcome.txt")

Reply With Quote
  #3  
Old May 2nd, 2003, 11:23 AM
Buraque Buraque is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Shimonoseki / JAPAN
Posts: 58 Buraque User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 4 sec
Reputation Power: 6
Thanks a million for your time defjam

I will try. If it doesn't works, I will have to do it the hard way:
Code:
If activelang="jp" then
<!--include this-->
elseif activelang="en" then
<!--include that-->
End if

etc..

Reply With Quote
  #4  
Old May 2nd, 2003, 02:22 PM
defjamninja defjamninja is offline
Overly white
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Fresno, CA
Posts: 83 defjamninja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
If your going to have more than 2 options a select case may be a better option. Another plus is that I find it easier to update.

Code:
activelang=lCase(Request.QueryString("lang")) 'convert to lower case

Select Case activelang
  Case "jp"
    <!-- #include... -->
  Case "en"
    <!-- #include... -->
  Case "blah"
    <!-- #include... -->
  Case "gibberish"
    <!-- #include... -->
  Case Else 'default
    <!-- #include... -->
End Select

Reply With Quote
  #5  
Old May 3rd, 2003, 02:24 AM
Buraque Buraque is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Shimonoseki / JAPAN
Posts: 58 Buraque User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 4 sec
Reputation Power: 6
Done!
It is working.
But with one little difference.
It is not Response.Execute but Server.Execute
Thanks.

Reply With Quote
  #6  
Old May 3rd, 2003, 11:11 AM
Buraque Buraque is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Shimonoseki / JAPAN
Posts: 58 Buraque User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 4 sec
Reputation Power: 6
Update:

Server.Execute is little different. It won't include any variable from the original page. I mean:
Code:
 page1.asp
name="Burak"
Server.Execute("page2.asp")
---------------
page2.asp
Response.Write name

This code will return "" because page2.asp will be executed in itself while <!--include--> can recognize all variables in original page. I can actually send a querystring like Server.Execute("page2.asp?name=Burak") but I am getting 'invalid URL' error. According to microsoft, this is a known bug and will be fixed.
Just FYI...

Reply With Quote
  #7  
Old May 5th, 2003, 08:00 AM
imbrokn imbrokn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: NJ
Posts: 428 imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 34 m 8 sec
Reputation Power: 10
Send a message via AIM to imbrokn
Word of caution

I wouldn't recommend having a querysting variable alone be inserted into the include statement. I think your just opening up a can of worms security wise allowing users to include any file they want via the querystring. I know your thinking security through obscurity and all that but still its not a good idea. The PHP forum has a list thread about security notes for programming with php, which are general hints for being safe, and most of them apply to asp as well. It maybe be good for you to read that article. It really makes you think. Also, at the very least, do some sort of verification that the the activelang variable does hold values that you expect. Either a regular expression, or a case statement. At least this way it isn't open ended.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > inserting a querystring variable into <!--include--> URL parth.. kinda tricky?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway