1

I have some warnings in my solution (no errors). Several of them are 'Expected expression' on server code tag. Take a look on the screenshot here. These warnings are only in jQuery script, never in the html section.

Is it possible to avoid these warnings? My code run as expected.

Thanks for your help.

1
  • If you've found my answer and help below of value, please up vote it and mark it as the answer! Thanks! Commented Apr 19, 2011 at 15:42

1 Answer 1

3

No. Visual studio doesn't like nesting code blocks like this at times. Just ignore it. Sometimes doing a rebuild makes them go away for whatever reason.

Also, be aware that JavaScript is not trustworthy and that this magic "IsAuthenticated" method in your JS is fallible and easily hacked. Be sure to cover your app!

Sign up to request clarification or add additional context in comments.

2 Comments

thank you. You say JavaScript is not trustworthy so how can I proceed in order to be sure user is authenticated in my page?
It's perfectly fine to let javascript know whether the user is authenticated, but be aware that someone can easily run your page in "authenticated" mode as far as javascript knows... If it opens up more capabilities such as showing form fields, making ajax calls, etc, make sure that you're not trusting it. An example would be, if the user is logged in, show the form fields to submit a comment. Well, what if they manually show the comment fields without being authenticated. Is your back-end smart enough to verify that they are REALLY authenticated and should have permissions to do that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.