Newbie to ASP.Net

X

Xarky

Hi,
I am writing a small application and I am facing the 2 following
problems.

1)
I have implemented an authentication screen (simple username and
password), and when user signs in, I use the following and redirect
user to a main page
Session["connected"] = username;

When user tries to visit the main page, without first having signed
in, in the Page_Load, I check the value of the Session["connected"]
and if its empty, I redirect user back to authentication screen.

Now when user signs out, Session["connected"] is set "" and user is
redirected to authentication screen.

When user have at leasted visted main page once in authenticated
state, and then in non-authenticated state, he tries again to visit
the main page, he is not being directed to authentication screen, but
entering main page normally. I tried to do some debugging in the
method Page_Load, but at the time descrived in this paragraph, it is
not entering in this method.

Is there any other method that I should handle/overload?


2)
I have followed this link to do a drop-down menu:
http://msdn.microsoft.com/library/d...ta/html/OfficeFrontPageCreateDropDownMenu.asp

Now one of the menu Items is Sign Out. In this Sign out I have done a
link to the Authentication screen described earlier. Now before I
redirect the user I require to do some operations like
Session["connected"] = "";

Can this be done with some scripting. I have done something similar
to this in another language, previously.


I hope someone understands my problems and helps me out.
Thanks in Advance
 
B

Bob Barrows [MVP]

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
 
B

B_O_B

Why not use forms authentication?

Alvin Bruney said:
for item # 1 you most likely are not verifying the value of the session
variable. In fact you should set it to null instead of an empty string so
then you can check like so
if(Session["ads"] == null)
redirect.

I agree with bob, you should post this in the asp.net newsgroup to prevent
pollution.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Xarky said:
Hi,
I am writing a small application and I am facing the 2 following
problems.

1)
I have implemented an authentication screen (simple username and
password), and when user signs in, I use the following and redirect
user to a main page
Session["connected"] = username;

When user tries to visit the main page, without first having signed
in, in the Page_Load, I check the value of the Session["connected"]
and if its empty, I redirect user back to authentication screen.

Now when user signs out, Session["connected"] is set "" and user is
redirected to authentication screen.

When user have at leasted visted main page once in authenticated
state, and then in non-authenticated state, he tries again to visit
the main page, he is not being directed to authentication screen, but
entering main page normally. I tried to do some debugging in the
method Page_Load, but at the time descrived in this paragraph, it is
not entering in this method.

Is there any other method that I should handle/overload?


2)
I have followed this link to do a drop-down menu:
http://msdn.microsoft.com/library/d...ta/html/OfficeFrontPageCreateDropDownMenu.asp

Now one of the menu Items is Sign Out. In this Sign out I have done a
link to the Authentication screen described earlier. Now before I
redirect the user I require to do some operations like
Session["connected"] = "";

Can this be done with some scripting. I have done something similar
to this in another language, previously.


I hope someone understands my problems and helps me out.
Thanks in Advance
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top