Hi,Im makin a web based application.For users to access it they need to login.
I m using java,jsp,html for this.I wish to know how can i prevent access to the pages of application without logging in i.e. if user types in URL of some page of application in the address bar he should be redirected to login page and only if login is correct should he be allowed to access the pages in application.Thx.
Ankita B
2
Light Poster
Recommended Answers
Jump to PostWhat you coded so far?
Jump to PostI don't know if there are better ways to do it but here is my suggestion. When the user logs in take the username and when the user goes to another page, send the username with the other data as hidden:
<input type="hidden" value="<%= username%>" name="username">
When you get to …
Jump to PostStart your own thread, and
In the database, where you store the usernames and passwords you can have an additional column that indicates if the user is admin or not.
When you login get that info along with the username and password. If the user logged in successful, use the …
Jump to PostIf you are going to save session info in the HTML you should also set a timestamp and check for expiry. Otherwize someone could log in, then save a favourite. That favourite would then work weeks later without another login.
Jump to PostI think you have exactly te same problem with cookies, except that they have an expiry mechanism built in. Sorry, I don't know how to set it via jsp.
All 18 Replies
Acidburn
0
Posting Pro
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
Ankita B
2
Light Poster
deepak_8917
0
Newbie Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
deepak_8917
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
deepak_8917
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
deepak_8917
0
Newbie Poster
deepak_8917
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
deepak_8917
0
Newbie Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
Ranvijay singh
0
Newbie Poster
deepak_8917
0
Newbie Poster
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.