Hello.
I wanted to make a website, but with a private section. The private section has to be accessed with a password. If I used a simple if statement to do so, will it be safe on the server side? Example:

Protected Sub AccessPrivate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles AccessPrivate.Click
        If InputBox("Enter password to unlock site:", "Password") = "password" Then
            MsgBox("Correct!")
        Else
            MsgBox("Incorrect!")
        End If
    End Sub

Would that be safe or would someone be able to view that source code?

No, you dont have to worry...asp.net is a server side scripting language. You can easily validate this by accesing the page via browser. Most browsers, if you right click from within the page, click on view source. You'll see that the code in the window is HTML.

The way it works when an asp.net page is called, the webserver processes your asp.net code, but will output HTML back to the browser. You see browsers are programmed to understand HTML, not asp.net, php, asp, java, etc...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.