How to change the include file dynamically(at run time) in the asp page

OneCorner
OneCorner used Ask the Experts™
on
Hello,

I have a classic asp page that has an include file like "<!--#include file="Loc/Language.inc"-->".  I would like to know how I can change it to "<!--#include file="Loc/LanguageABC.inc"-->" at runtime depending on the condition of the variable.

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Use this:

<% If I_want_to_include_file_1 = True Then %>
  <!--#include file="includefile1.asp"-->
<% Else %>
  <!--#include file="includefile2.asp"-->
<% End If %>

Open in new window


More information can be found here:
http://www.4guysfromrolla.com/webtech/022504-1.shtml

Author

Commented:
ok, this is in the asp page:

-------------------------------------------------------------------------------------------------------------------------------
<!--#include file="Security.inc"-->
<!--#include file="Loc/Common.inc"-->
<!--#include file="Wizards/WhipWizardWrapper/WhipWizardWrapperInclude.asp"-->

<%

      Response.Expires = -1      
   
      Dim lngDiscoveryRuleID
      Dim strDiscoveryName
      Dim strDiscoveryDesc

                 If IsEmpty(Request("strDiscoveryRuleName")) Then
          strDiscoveryName = ""
      Else
          strDiscoveryName = (Request("strDiscoveryRuleName"))
                      strDiscoveryName = replace(strDiscoveryName,"$$","+")
       
      End If
      
      If IsEmpty(Request("strDiscoveryRuleDesc")) Then
          strDiscoveryDesc = ""
      Else
          strDiscoveryDesc = (Request("strDiscoveryRuleDesc"))
          strDiscoveryDesc = replace(strDiscoveryDesc,"$$","+")
      End If

-----------------------------------------------------------------------------------------------------------------------

It depends on the Request("strDiscoveryRuleName").  If the Request("strDiscoveryRuleName") contains the character like "%u" then use
<!--#include file="includefile1.asp"-->
otherwise use
<!--#include file="includefile2.asp"-->
Try:

<% If Request("strDiscoveryRuleName").contains("%u") = True Then %>
  <!--#include file="includefile1.asp"-->
<% Else %>
  <!--#include file="includefile2.asp"-->
<% End If %>

Open in new window


Replace %u with whatever char you're looking for.
Big MontyWeb Ninja at large
Commented:
working classic asp code:

<% 
strDiscoveryRuleName = Request("strDiscoveryRuleName")
If InStr( strDiscoveryRuleName, "%u") > 0 Then %>
  <!--#include file="includefile1.asp"-->
<% Else %>
  <!--#include file="includefile2.asp"-->
<% End If %>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial