password protecting a page

P

Phil Hellmuth

Pardon my ignorance...I'm new to .NET...but I want a user to be forced
to submit login credentials before displaying a page. Is there a quick,
easy way to do this? Don't worry about verifying the ID/PW...that's
taken care of.

Thanks in advance.
 
D

David Longnecker

If you're on an IIS box, you can turn Windows Authentication on and have
them authenticate to the domain of the server (assuming an internal application).


If you're authenticating using forms via Membership, you can add a Login
control to your page (.NET 2.0+). This control, along with a bit of connecting
via your web.config and your SQL Server, will provide authentication and
authorization functionality.

If you simply just want them to type in SOMETHING, then two text boxes and
a button with a function in the code to verify the input.

Or something else? You mention that the authentication (verifying) is taken
care of, but with no insight how... if you have a secondary user control/web
service for this, then a couple text boxes may be what you're looking for
(opting for simplicity).

HTH.

-dl
 
P

Phil Hellmuth

Thanks for your response. The purpose is to prevent unauthorized users
from seeing a particular page. My client simply wants to use hard-coded
ID/PW values. The only way to get to the page is by entering the url.
Ideally, a dialog box prompting for credentials is the way to do this,
as opposed to an additional page. Does your second paragraph accomplish
this?
 
L

Lloyd Sheen

Phil Hellmuth said:
Thanks for your response. The purpose is to prevent unauthorized users
from seeing a particular page. My client simply wants to use hard-coded
ID/PW values. The only way to get to the page is by entering the url.
Ideally, a dialog box prompting for credentials is the way to do this, as
opposed to an additional page. Does your second paragraph accomplish
this?

If you are just looking for a simple roll your own method you could check
for a session item on the page load and if it does not exist then redirect
to the logon page (which when filled in correctly would redirect them to the
page which is password protected. It would also create the session item so
that subsequent visits to the page in the session would not need to be
revalidated.

Hope this helps.

Lloyd Sheen
 

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,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top