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. View Source

View Source

Scheduled Pinned Locked Moved ASP.NET
helpquestion
13 Posts 7 Posters 1 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.
  • C Christian Graus

    Why are you using hidden fields instead of viewstate ?

    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

    K Offline
    K Offline
    Khan Bangash
    wrote on last edited by
    #3

    Please Tell me Just How Can I disable View Source.(When u right click on a page and Click on View Source). I want to disable View Source on page and also in toolbar "view"

    C E 2 Replies Last reply
    0
    • K Khan Bangash

      Hi All I have a page in which I Send some important Data in hiden fields. Now the problem is that when the page load and u right click it show the source code. How can I Disable the Source Code of the page. Also From the Menu Bar View. Please Help me it is very urgent. Thanks in Advance. With Best Regards. Bangash

      K Offline
      K Offline
      Kapil Thakur
      wrote on last edited by
      #4

      hi, YOU CANNOT DO THAT. you can stop the right click on browser....but you cannot disable ViewSource menuitem in View menu in toolbar.......it just cannot be achieved by any means.... i once had the same problem. you can decrypt the code but make sure to take a back up of html. Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com

      1 Reply Last reply
      0
      • K Khan Bangash

        Hi All I have a page in which I Send some important Data in hiden fields. Now the problem is that when the page load and u right click it show the source code. How can I Disable the Source Code of the page. Also From the Menu Bar View. Please Help me it is very urgent. Thanks in Advance. With Best Regards. Bangash

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #5

        There is no way that you can safely protect the source of the page. If you don't want the data to be available to anyone, don't put it in the page. There is some Javascript that can disable some of the options in some specific browser, but anyone interrested in viewing the source code can use a different browser or disable Javscript to be able to see the source.

        --- b { font-weight: normal; }

        K 1 Reply Last reply
        0
        • G Guffa

          There is no way that you can safely protect the source of the page. If you don't want the data to be available to anyone, don't put it in the page. There is some Javascript that can disable some of the options in some specific browser, but anyone interrested in viewing the source code can use a different browser or disable Javscript to be able to see the source.

          --- b { font-weight: normal; }

          K Offline
          K Offline
          Khan Bangash
          wrote on last edited by
          #6

          Actually I m sending Username and Password to a page in hidden fields. If u can please Tell what method should I use. Please give me a coding example. Its very urgent. Thankx for ur comments

          R G 2 Replies Last reply
          0
          • K Khan Bangash

            Actually I m sending Username and Password to a page in hidden fields. If u can please Tell what method should I use. Please give me a coding example. Its very urgent. Thankx for ur comments

            R Offline
            R Offline
            Ritika S
            wrote on last edited by
            #7

            Hi, u can use this Javascript code function NoRightClick() { if (event.button==2) { alert('No right clicks allowed.') } } document.onmousedown=NoRightClick Regards, Ritika

            Ritika

            K 1 Reply Last reply
            0
            • K Khan Bangash

              Please Tell me Just How Can I disable View Source.(When u right click on a page and Click on View Source). I want to disable View Source on page and also in toolbar "view"

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

              You can't stop it from the menu, hence my asking why you;re writing insecure code in the first place. Is there a reason ?

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

              1 Reply Last reply
              0
              • R Ritika S

                Hi, u can use this Javascript code function NoRightClick() { if (event.button==2) { alert('No right clicks allowed.') } } document.onmousedown=NoRightClick Regards, Ritika

                Ritika

                K Offline
                K Offline
                Khan Bangash
                wrote on last edited by
                #9

                Dear Ritika Hi have disabled right click. I want to disable the view source in menubar. Is that posible. If not then please tell me how should I send information so that not displayed in view source.

                R 1 Reply Last reply
                0
                • K Khan Bangash

                  Dear Ritika Hi have disabled right click. I want to disable the view source in menubar. Is that posible. If not then please tell me how should I send information so that not displayed in view source.

                  R Offline
                  R Offline
                  Ritika S
                  wrote on last edited by
                  #10

                  Hi I Dont think therz anyway u can do that. Regards,

                  Ritika

                  1 Reply Last reply
                  0
                  • K Khan Bangash

                    Hi All I have a page in which I Send some important Data in hiden fields. Now the problem is that when the page load and u right click it show the source code. How can I Disable the Source Code of the page. Also From the Menu Bar View. Please Help me it is very urgent. Thanks in Advance. With Best Regards. Bangash

                    L Offline
                    L Offline
                    l0kke
                    wrote on last edited by
                    #11

                    Basically, your approach is completelly wrong. Even if you are able to disable 'View source' code in browser, that still doesn't prevent users to see your source code (anybody can make own 'browser', or just write few lines of code to run WebRequest and retrieve source of your html). If you need to pass any sensible data, use ViewState, for example (anyway, it is not 100% secure, but it is not in plain text at least) override LoadViewState and SaveViewState method of your ASP.NET page to implement this functionality. If you don't know how to do this, ask google: http://www.google.co.uk/search?hl=en&q=override+SaveViewState&btnG=Search&meta= I still don't understand, why do you want to pass sensible data into a page, why you just don't keep them on server? Pilo

                    1 Reply Last reply
                    0
                    • K Khan Bangash

                      Please Tell me Just How Can I disable View Source.(When u right click on a page and Click on View Source). I want to disable View Source on page and also in toolbar "view"

                      E Offline
                      E Offline
                      ednrgc
                      wrote on last edited by
                      #12

                      You can't. Period.

                      1 Reply Last reply
                      0
                      • K Khan Bangash

                        Actually I m sending Username and Password to a page in hidden fields. If u can please Tell what method should I use. Please give me a coding example. Its very urgent. Thankx for ur comments

                        G Offline
                        G Offline
                        Guffa
                        wrote on last edited by
                        #13

                        Please read the first sentence of my previous post again. Repeat until the urge to put sensetive data in the page fades away.

                        --- b { font-weight: normal; }

                        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