473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

2 different homepages

Hi all,

I'm starting out with ASP .NET. I'd like to have a homepage that shows
a completely different page depending on whether a user is logged in -
i.e. a generic welcome page if not logged in, or a user-specific
account page if logged in.

How is this normally achieved with ASP .NET? With a MultiView control,
or is there a better way to do this?

Thanks,

Paul

May 15 '06 #1
2 1106
You could use the multiview control, but I prefer to use
Response.Redirect("...")

In my Page_Load event I use code like the following. (notice that I don't
use Membership.GetUser() which would cause a database lookup)

protected void Page_Load(object sender, EventArgs e)

{

// this page is only for non authenticated users

IPrincipal iPrincipal = HttpContext.Current.User;

if (iPrincipal.Identity.IsAuthenticated)

....

Peter Kellner

http://peterkellner.net


<pa*********@gmail.com> wrote in message
news:11*********************@j33g2000cwa.googlegro ups.com...
Hi all,

I'm starting out with ASP .NET. I'd like to have a homepage that shows
a completely different page depending on whether a user is logged in -
i.e. a generic welcome page if not logged in, or a user-specific
account page if logged in.

How is this normally achieved with ASP .NET? With a MultiView control,
or is there a better way to do this?

Thanks,

Paul

May 15 '06 #2
pa*********@gmail.com's wild thoughts were released on 14
May 2006 19:48:01 -0700 bearing the following fruit:
Hi all,

I'm starting out with ASP .NET. I'd like to have a homepage that shows
a completely different page depending on whether a user is logged in -
i.e. a generic welcome page if not logged in, or a user-specific
account page if logged in.

How is this normally achieved with ASP .NET? With a MultiView control,
or is there a better way to do this?


You could also use the login view

'The LoginView control allows you to display different
information to anonymous and logged-in users. The control
displays one of two templates: the AnonymousTemplate or the
LoggedInTemplate. In the templates, you can add markup and
controls that display information appropriate for anonymous
users and authenticated users, respectively.'

Jan Hyde (VB MVP)

--
An optometrist's office is a site for sore eyes. (Shawn Kennedy)

May 15 '06 #3

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

Similar topics

1
by: Neil | last post by:
Folks, I've got a problem at work, and I'm hoping that someone out there may have had something similar (although I doubt it!) or may be able to offer some advice. I'm in the process of...
5
by: Scott Matthews | last post by:
I've recently come upon an odd Javascript (and/or browser) behavior, and after hunting around the Web I still can't seem to find an answer. Specifically, I have noticed that the Javascript...
16
by: Geoff Cox | last post by:
Hello, I publish some web pages using large fonts and would like to give the user the opportunity to print the pages using a smaller font. I believe that this is possible using different style...
5
by: Gaz | last post by:
Hi, I have found an issue when comparing Firefox with IE6 (Windows) where a page links to a css file that is in it's own directory. IE6 URL property of the background css element uses the...
1
by: Avanish Pandey | last post by:
Hello All We have 3 differen services (in 3 different server) Service A,B,C . We want to implement distributed transaction when call methods of B and C from A. Is it possible? if yes then how? ...
5
by: Hendrik Schober | last post by:
Hi, we just run into the problem, that "default" alignment in the project properies dialog seem to be different. We have a project that's a DLL, which is linked with a couple of LIBs. All are...
3
by: asanford | last post by:
I want to create an ASP.NET web application that receives a form POST message, inspects the data, and reroutes the request to one of many different servers. I wrote an IHttpModule which...
27
by: Ben Finney | last post by:
Antoon Pardon wrote: > I just downloaded your enum module for python > and played a bit with it. IMO some of the behaviour makes it less > usefull. Feedback is appreciated. I'm hoping to...
4
by: cantatahost | last post by:
Hello, Likely this has been asked before... We have a library (in DLL form) that we distribute. The interface to the library is all C, but within the library it uses C++ in many places. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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,...

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.