"if" problem. Still. Value is ok.

M

Miguel Dias Moura

Hi,

i have this code line in a script in my ASP.net / VB web site:

dim msgNewsletterAction

msgNewsletterAction = Request.Form("newsletterAction")

if msgNewsletterAction = "go" Then
Code1
Else
Code2
End If

Code2 runs everytime even when msgNewsletterAction = "go". Code1 never runs.

I sent the value of msgNewsletterAction to an email address using
AspNetEmail.
I readed my email and the value of the variable was correct and equal to
"go".

So why doesn't Code1 runs?

Thanks,
Miguel
 
G

Guest

There are somethings you can try.

(1) Trim it :- Trim(Request.Form("newsletterAction")
(2) Make a less specific request :- Request("newsletterAction"
(3) Combine above two :- Trim(Request("newsletterAction")
(4) Show us the forms on the we
(5) Response.Write("***" & Trim(Request("newsletterAction")) & "***"

With (5) you can see if there are any space comign through (e.g. "go ") which would cause the If to evaluate to fals

Rasika Wijayaratne
 
G

Guest

You can also try this
(6) LCase(Trim(Request("newsletterAction"))), just to ensure the requested value is lowercase before the comparison is done. LCase function makes the parameter string into lowe case

Rasika Wijayaratn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top