473,287 Members | 3,295 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,287 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 1102
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. ...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.