Solved

remove case sensitivity from condition

Posted on 2010-09-08
10
423 Views
Last Modified: 2012-05-10
How to I remove case sensitivity from the condition below?

if (Request.QueryString("TN") == "ConflictRequest" && (Request.QueryString("EI7") == "No Conflict, awaiting retention" | Request.QueryString("EI7") == "No Conflict, work accepted"))
...

I need the condition to work no matter the case of the querystring contents.
0
Comment
Question by:GessWurker
  • 4
  • 3
  • 3
10 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 33628144
Could you not use variables in this, so assign Request.QueryString(...) to a variable then convert that to upper or lower case then check against that
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33628154
egf

dim sTN


sTN = Request.QueryString("TN")

sTN = lcase(sTN)

0
 
LVL 2

Expert Comment

by:Comtek
ID: 33628165
You can make everything lower case:

if (Request.QueryString["TN"].ToLower() == "conflictrequest" && (Request.QueryString["EI7"].ToLower() == "no conflict, awaiting retention" | Request.QueryString["EI7"].ToLower() == "no conflict, work accepted"))
0
 

Author Comment

by:GessWurker
ID: 33628298
nope. so far nothing works. all suggestions result in 500 internal server error. Note: We're not working with pure classic asp. See code start up to conditions below...

<%@ Language='JavaScript' %>
<%
//  ASP support page

//==================================================
// set location of Web App
//
   var   sInmWebAppDllURL, sInmWebAppExeURL;
   var   sServerName, sExecDirectory, sExecDLL;
   var   sProtocol = '';
   var      sAuthUser, sAuthPassword, sAuthType;
   var      bBasicAuthentication;
   var  tbRec;
   var newHTML;
   
   if (Request.QueryString("TN") == "Engagements" && Request.QueryString("EF0") == "ConflictRequestID")
   {
     
       tbRec = " Engagements record ";
     newHTML = '<input type=button style="font-family: arial, Helvetica,sans-serif; font-size:12pt; font-style:normal; color:red" value= "Click here to finish new' + tbRec + '" name=finish onclick=location.replace("/dbtw-wpd/exec/dbtwpub.dll?TN=Engagements&QY=find%20(ConflictRequestID%20%3D%20' + Request.QueryString("EI0") + '&RF=EprocessAutoRefresh&EF=EprocessEditForm&AC=QBE_QUERY&XC=%2Fdbtw-wpd%2Fexec%2Fdbtwpub.dll")>';
      
   }
 
   else if (Request.QueryString("TN") == "Engagements" && Request.QueryString("EF0") == "EngagePreparerEmail")
   {
     
       tbRec = " Engagements record ";
     newHTML = '<input type=button style="font-family: arial, Helvetica,sans-serif; font-size:12pt; font-style:normal;" value= "OK" name=OK onclick=location.replace("../../Ask-A-Librarian-FAQs/ConflictCheck/ConflictCheckCirculation.htm")>';
      
   }
 
   else if (Request.QueryString("TN") == "ConflictRequest" && (Request.QueryString("EI7") == "No Conflict, awaiting retention" | Request.QueryString("EI7") == "No Conflict, work accepted"))
   {
...
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 250 total points
ID: 33628344
oh its javascript try this then

mystring.toLowerCase()
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Assisted Solution

by:Comtek
Comtek earned 250 total points
ID: 33628371
Ahh, so it's JavaScript then. Instead of .ToLower() try .toLowerCase():

if (Request.QueryString("TN").toLowerCase() == "engagements" && Request.QueryString("EF0").toLowerCase() == "conflictrequestiud")

You could also declare those variables earlier:
var TN = Request.QueryString("TN").toLowerCase();
var EF0 = Request.QueryString("EF0").toLowerCase();

then use:
if (TN == "engagements" && EF0 == "conflictrequestiud")

The last suggestion would probably be the cleanest way to do it.
0
 

Author Comment

by:GessWurker
ID: 33628418
Yeah... I've had all the same ideas as you folks. So far, no luck. Anytime I try to convert case, I end up with an error. Will keep trying.
0
 
LVL 2

Expert Comment

by:Comtek
ID: 33628437
You get an error on this:

var TN = Request.QueryString("TN").toLowerCase();
var EF0 = Request.QueryString("EF0").toLowerCase();
?
If so, what is the error?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33628545
Just a thought, can you use Request object in javascript? I thought asp code couldn't mix with JS.
Try this js alternative http://snipplr.com/view/799/get-url-variables/ (and read the comments as their are alternatives)
0
 

Author Comment

by:GessWurker
ID: 33629800
All: Thanks for your help. I'll split up points. But here's what worked:

   var EI7 = String(Request.QueryString("EI7")).toUpperCase()
etc. etc.

just as good, of course:

 var EI7 = String(Request.QueryString("EI7")).toLowerCase()
etc. etc.

Without "String", total failure.

YIKES!

Anyway... thanks for your participation!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Animated .jpg? 13 60
ngStyle with an input variable doesn't work 14 30
Questions about INCLUDE FILES 2 20
How to change pointer icon to hand icon on mouseover 2 19
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now