Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Check Caps Lock Status

Check Caps Lock Status

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsysadmin
11 Posts 5 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 1 Offline
    1 Offline
    11Developer
    wrote on last edited by
    #1

    hello, I want to restrict user to access my site if his Caps Lock Key is Off, so i need to check caps lock status whether he presses a-z,A-Z,or 0-9 keys in asp.net code. i have tried following code which is working on Local but not on Server if (Console.CapsLock) { lbl.Text="Caps is on"; } thanks

    N OriginalGriffO 2 Replies Last reply
    0
    • 1 11Developer

      hello, I want to restrict user to access my site if his Caps Lock Key is Off, so i need to check caps lock status whether he presses a-z,A-Z,or 0-9 keys in asp.net code. i have tried following code which is working on Local but not on Server if (Console.CapsLock) { lbl.Text="Caps is on"; } thanks

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      It is clearly understood that you have no idea about web applications. ASP.NET can't check the keyboard's caps lock status. If you have a text box, hook a JS OnKeyPress event and check the ASCII values of the key pressed. This will give you the typed letters case. But still you will not get the caps lock status. This should be the best question posted in ASP.NET forums this week. :)

      Best wishes, Navaneeth

      1 1 Reply Last reply
      0
      • N N a v a n e e t h

        It is clearly understood that you have no idea about web applications. ASP.NET can't check the keyboard's caps lock status. If you have a text box, hook a JS OnKeyPress event and check the ASCII values of the key pressed. This will give you the typed letters case. But still you will not get the caps lock status. This should be the best question posted in ASP.NET forums this week. :)

        Best wishes, Navaneeth

        1 Offline
        1 Offline
        11Developer
        wrote on last edited by
        #3

        so this means we can get caps status only if v r using letters(a-z) not digits(0-9) or we are using windows application. thanks for ur reply

        N 1 Reply Last reply
        0
        • 1 11Developer

          so this means we can get caps status only if v r using letters(a-z) not digits(0-9) or we are using windows application. thanks for ur reply

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          I reiterate. You CANT get the caps lock status in web application.

          11Developer wrote:

          so this means we can get caps status only if v r using letters(a-z) not digits(0-9)

          Numbers don't have a case so that question is irrelevant. You can get the case of a-z of course. As I said, get the ASCII code and compare. Why you need to get the caps lock status? If you can tell us what are you trying to solve, there should be a better solution.

          Best wishes, Navaneeth

          1 1 Reply Last reply
          0
          • N N a v a n e e t h

            I reiterate. You CANT get the caps lock status in web application.

            11Developer wrote:

            so this means we can get caps status only if v r using letters(a-z) not digits(0-9)

            Numbers don't have a case so that question is irrelevant. You can get the case of a-z of course. As I said, get the ASCII code and compare. Why you need to get the caps lock status? If you can tell us what are you trying to solve, there should be a better solution.

            Best wishes, Navaneeth

            1 Offline
            1 Offline
            11Developer
            wrote on last edited by
            #5

            i want that user can't logged in if his caps lock is not ON, this is a security feature which is not known to anonymous users and for logging in he has to enter numbers not letters.So hw to validate dis sceneraio????

            C A 2 Replies Last reply
            0
            • 1 11Developer

              hello, I want to restrict user to access my site if his Caps Lock Key is Off, so i need to check caps lock status whether he presses a-z,A-Z,or 0-9 keys in asp.net code. i have tried following code which is working on Local but not on Server if (Console.CapsLock) { lbl.Text="Caps is on"; } thanks

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #6

              Judging by your communications with Navaneeth, there are some serious gaps in your knowledge. When he says "ASP.NET cannot get the caps lock status" what he means is: It is physically impossible for an ASP.NET application to find out the caps lock status on a user machine. Why? Because when you execute an ASP.NET application, the code you write is executed on the SERVER not the CLIENT. The Client machine is the one with the user, and the keyboard. So the Server cannot know what the User keyboard is doing. It is similar to this: If you call me on the phone, can you smell my coffee? You are the Server, I am the Client. Can you even tell if I have a cup of coffee? You cannot implement your "security" feature. And even if you could, just how "secure" do you really think it is? Go, google ASP.NET Membership Class, and think again.

              No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              1 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                Judging by your communications with Navaneeth, there are some serious gaps in your knowledge. When he says "ASP.NET cannot get the caps lock status" what he means is: It is physically impossible for an ASP.NET application to find out the caps lock status on a user machine. Why? Because when you execute an ASP.NET application, the code you write is executed on the SERVER not the CLIENT. The Client machine is the one with the user, and the keyboard. So the Server cannot know what the User keyboard is doing. It is similar to this: If you call me on the phone, can you smell my coffee? You are the Server, I am the Client. Can you even tell if I have a cup of coffee? You cannot implement your "security" feature. And even if you could, just how "secure" do you really think it is? Go, google ASP.NET Membership Class, and think again.

                No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                1 Offline
                1 Offline
                11Developer
                wrote on last edited by
                #7

                Thanks for the reply... but i have to search for it as it is my duty to obey my uneducated seniors.....

                OriginalGriffO C 2 Replies Last reply
                0
                • 1 11Developer

                  Thanks for the reply... but i have to search for it as it is my duty to obey my uneducated seniors.....

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #8

                  Then educate them! A stupid idea does not become a good idea just because a manager proposed it, no matter how much they think it should.

                  No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  1 Reply Last reply
                  0
                  • 1 11Developer

                    i want that user can't logged in if his caps lock is not ON, this is a security feature which is not known to anonymous users and for logging in he has to enter numbers not letters.So hw to validate dis sceneraio????

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #9

                    Write a windows app. Or you may be able to do it with a Silverlight web app. Also, clean out your ears, you've been answered. Finally, when you're talking to a client, have some idea about the technology first, instead of assuming that we'll do your work for you. Nodding the whole time is not productive, you end up promising things that are not possible.

                    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                    1 Reply Last reply
                    0
                    • 1 11Developer

                      Thanks for the reply... but i have to search for it as it is my duty to obey my uneducated seniors.....

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      11Developer wrote:

                      . but i have to search for it as it is my duty to obey my uneducated seniors.....

                      ROTFL - you plainly started as uneducated as they are. If you're the programmer, it's your JOB to tell them when something is not possible. If you were to learn about ASP.NET before you started in this job, you could have done that in the first instance, instead of after the fact.

                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                      1 Reply Last reply
                      0
                      • 1 11Developer

                        i want that user can't logged in if his caps lock is not ON, this is a security feature which is not known to anonymous users and for logging in he has to enter numbers not letters.So hw to validate dis sceneraio????

                        A Offline
                        A Offline
                        AlexeiXX3
                        wrote on last edited by
                        #11

                        Who cares about the user having the caps lock on or off If you want it secure, make sure the users have a very strong password and also make it case sensitive There are meny thing that you can do server side to make an app secure, but as everyone here ahs told you, it is not possible to check the caps lock status fromm the server side The only option is as someone else already told you, use javascript and as soon as the users types something do the check with javascript

                        Alexei Rodriguez

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups