Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 authenticate it...

Author  Topic 

jhermiz

3564 Posts

Posted - 2004-01-15 : 14:09:35
Simple .htm page that is on our web server. I just want it so that the page does not display unless the end user has entered a specific password. Is this possible?

I dont want anything like a GUI or anything like that...just something that pops up and asks for a password..if its correct than the end user gets the page displayed otherwise nothing.

Thanks,
Jon

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-01-15 : 14:19:45
Do you want it to intergrate with Windows Security?

You could probably do this easily with Javascript. Put the entire content in a DIV tag, have a Javascript prompt box open up onload(). If they authenticate, then do theDiv.style.display = block;
You'd need code in the page to disable right-click because they could view source and see teh content and password.

There are some other more complicated ways to do this if you need more security (such as having the javascript read a file and output that if they authenticate).

Michael



<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-01-15 : 14:25:04
Hi Michael

I m not really a web guru, most of my apps are client server based where the client sits on the network rather than as a web page.

I guess the issue here is ANYONE can see this page. I want only our parent and sister companies to view it...but some of these guys are on different domains and definately on different network OSes...

So I guess the BEST way to do this (simple way) is to use the Javascript you mentioned...

So say I had a page with just this


<html>
<body>hello world</body>
</html>


So what If I wanted that prompt to appear...around this how would I go about doing that.

Thanks,
Jon

Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2004-01-15 : 14:59:12
Make your network guy earn his pay and have him do it ... restrict access to the page with IP control lists.

Jonathan
Gaming will never be the same
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-01-15 : 15:40:32
Jon,
Try this. It doesn't get around users that can do a "view source" and see your text. There is client side cod eto get around right-click view source, but nothing that I know of that will stop using going to View-->Source. I'm not sure if we'll be able to write something in client side script that will keep them out of the content 100%. The only way to do that would be to not send the content down to the browser in the first place (can easily be done with asp / asp.net)


<html>
<body>
<SCRIPT LANGUAGE=javascript>
<!--
function window.onload(){
var theRightPassword = 'thisisthepassword';
var enteredPassword = '';
enteredPassword = prompt('Enter your password below', '');

if (enteredPassword == theRightPassword){
theBody.style.display = 'block';
}
else{
alert('i got here');
emptyBody.style.display = 'block';
}

}
//-->
</SCRIPT>

<div id="theBody" style="display:none;">
hello world
</div>

<div id="emptyBody" style="display:none;">
No Soup For you!
</div>
</body>
</html>



When prompted, the password is thisisthepassword

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-01-15 : 15:42:41
Hi mike,

i really like jonathon's suggestion if my admin can do it..
i will find out soon enough. however, i do appreciate your time and help.

thanks,
jon
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-01-15 : 16:54:31
Yes, the admin should do it. That's the more secure way I was talking about.

Basic Authentication (a setting in IIS) on the file would work too.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -