473,496 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Default page code

Hi

What code I need on the default page to call login page if the current user
is not authenticated/loggedin and carry on if the user is
authenticated/loggedin?

Thanks

Regards
Dec 6 '05 #1
5 1119
I suggest you read about the authentication model for asp.net. It sounds
like you are probably using Forms authentication, meaning a login page where
you check against your own datastore.

Some urls:
(ASP.NET v1.1)
http://msdn.microsoft.com/library/de...entication.asp

ASP.NET v2.0)
http://msdn.microsoft.com/library/de...aght000012.asp

Cheers!
Jay

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:OJ****************@TK2MSFTNGP15.phx.gbl...
Hi

What code I need on the default page to call login page if the current
user is not authenticated/loggedin and carry on if the user is
authenticated/loggedin?

Thanks

Regards

Dec 6 '05 #2
Forms Authentication is usually your best bet in ASP.NET.
It is easily configured in your web.config file.
Here's more information:
http://www.dotnetbips.com/displayarticle.aspx?id=9
http://support.microsoft.com/default...b;en-us;311495
http://www.4guysfromrolla.com/webtech/121901-1.2.shtml

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:OJ****************@TK2MSFTNGP15.phx.gbl...
Hi

What code I need on the default page to call login page if the current
user is not authenticated/loggedin and carry on if the user is
authenticated/loggedin?

Thanks

Regards

Dec 6 '05 #3
It all looks quite complicated. I guess my needs are much simpler for the
form authentication method that I am using. I am using the following code in
Page_Load in of Default.aspx.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If not User.Identity.IsAuthenticated Then
' Call login.aspx, how?
End If
End Sub

I just need to know if the current user in not authenticated how should I
call the login page? Am I on the right lines?

Thanks

Regards

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl...
Forms Authentication is usually your best bet in ASP.NET.
It is easily configured in your web.config file.
Here's more information:
http://www.dotnetbips.com/displayarticle.aspx?id=9
http://support.microsoft.com/default...b;en-us;311495
http://www.4guysfromrolla.com/webtech/121901-1.2.shtml

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:OJ****************@TK2MSFTNGP15.phx.gbl...
Hi

What code I need on the default page to call login page if the current
user is not authenticated/loggedin and carry on if the user is
authenticated/loggedin?

Thanks

Regards


Dec 6 '05 #4
well you could do it that way, but i wouldn't recommend it.

you can set a page or folder as requiring authentication in web.config.
asp.net will automatically redirect to login page if user is not
authenticated, and back to that page after they login.

check out

http://www.4guysfromrolla.com/webtech/110701-1.shtml

Dec 6 '05 #5
Don't get discouraged. It's not very hard.
It's mostly just setting a few config values and the rest is mostly
automatic.
One of the links was broken, here's the working one:
http://www.dotnetbips.com/Articles/d...icle.aspx?id=9

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
It all looks quite complicated. I guess my needs are much simpler for the
form authentication method that I am using. I am using the following code
in Page_Load in of Default.aspx.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If not User.Identity.IsAuthenticated Then
' Call login.aspx, how?
End If
End Sub

I just need to know if the current user in not authenticated how should I
call the login page? Am I on the right lines?

Thanks

Regards

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl...
Forms Authentication is usually your best bet in ASP.NET.
It is easily configured in your web.config file.
Here's more information:
http://www.dotnetbips.com/displayarticle.aspx?id=9
http://support.microsoft.com/default...b;en-us;311495
http://www.4guysfromrolla.com/webtech/121901-1.2.shtml

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:OJ****************@TK2MSFTNGP15.phx.gbl...
Hi

What code I need on the default page to call login page if the current
user is not authenticated/loggedin and carry on if the user is
authenticated/loggedin?

Thanks

Regards



Dec 7 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5714
by: whtevr | last post by:
Consider this HTML on an ASP page called default.asp in a virtual directory: <FORM name="Flogin" id="Flogin" action="" method=post> </FORM> Do I HAVE to put the literal "default.asp" into the...
2
2006
by: DaveO | last post by:
Hi All. I have a web with the default startup page as : index.htm that contains an iFrame. The default page, that loads in the iFrame, when index.htm is loaded, is htmPage1.htm I want...
7
1782
by: aDc | last post by:
Hello, I am getting some strange behavior with my ASP.NET application. Anytime I make a request to a page in the application the page_load for that page is fired as expected BUT then the...
2
2309
by: Michael McGuire | last post by:
I have a very strange problem occurring on a couple of servers I have an ASP.NET application written in C# running on IIS 5.0 with Windows 2000 Server. This is the first ASP.NET application...
2
2300
by: Goober | last post by:
I have the following default.aspx page that works properly. However, what I want to do is to link the graphics within it (that are hard coded now in the default web page) to our corporate...
2
1356
by: Sanjay Pais | last post by:
We are using ASP.2.0 and I was wondering if any one knew how I could modify the default.aspx. What I want to do is add some new HTML to the aspx page as well as either change the code behind or...
3
2154
by: vijay_kerji | last post by:
Dear All, I have a ASP web application running with CS2000. It has Default page as default.asp It also contains .NET ASPX pages, which will be called from ASP pages. Can I convert the default...
5
3557
by: Juan T. Llibre | last post by:
OK, guys, usually I answer questions instead of asking them, but this thing has me scratching my head. Why is the default for AutoEventWireup different for C# and VB.NET ? In VS 2005, if I...
10
2491
by: Brad Baker | last post by:
I have an asp.net/csharp application that requires a particular variable to work properly. This variable is usually passed via a query string in the URL when the application is first run but under...
7
2259
by: Jonathan Wood | last post by:
My site requires all users to log on. Depending on the user's role, they will have access to a certain set of pages. I implemented this by redirecting the user to the appropriate home page in...
0
6991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7373
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.