473,320 Members | 1,612 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,320 software developers and data experts.

What Determines the Default Page (And How to Change)?

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
the handler for the LoggedIn event of the Login control.

The problem is that users don't always go through the Login control. For
example, if I check the Remember Me box and then disconnect and then
reconnect, I go straight to default.aspx in the root folder withough having
to log in again. And so my code doesn't have a chance to redirect the user
based on role in this case.

I'm thinking the answer would be to modify the default page depending on the
current role, but I'm not sure how to do that. I'm also curious if anyone
has any better ideas.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Nov 11 '07 #1
7 2253
The default page is determined by the web server and not something to be
changed in code. Also, it's good not to mess with the list because it can
affect perormance. The longer the list for example, the longer it takes IIS
to check what is the default page for a directory.

Why don't you put a check into the default.aspx page itself? You can check
if the user is currently authenticated and if so, determine where they
should go. Essentially, your default page just becomes a redirecting agent.
The tricky part though is you wouldn't be able to have a normal default.aspx
page since you can't determine whether the person who is visiting it just
returned to the site, or if they have been logged on for a while and are
just navigating around. With the right structure though this can be a moot
point, especially if the default.aspx page isn't something that they'll hit
except when they return to the site.
--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
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
the handler for the LoggedIn event of the Login control.

The problem is that users don't always go through the Login control. For
example, if I check the Remember Me box and then disconnect and then
reconnect, I go straight to default.aspx in the root folder withough
having to log in again. And so my code doesn't have a chance to redirect
the user based on role in this case.

I'm thinking the answer would be to modify the default page depending on
the current role, but I'm not sure how to do that. I'm also curious if
anyone has any better ideas.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Nov 11 '07 #2
Couple of ways you can handle this one.

1. Create a basepage class and have all the pages derive from it. Override
the onpreinit event in the basepage class and add your logic to redirect
users based on thier current roles.

2. You can override the onauthenticate event in global.asax file and if the
user is already authenticated and the current requested url is default.aspx,
then apply your logic to redirect appropriately.

Thanks,
Kumaran
Software Architect
www.superbuild.com
"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
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
the handler for the LoggedIn event of the Login control.

The problem is that users don't always go through the Login control. For
example, if I check the Remember Me box and then disconnect and then
reconnect, I go straight to default.aspx in the root folder withough
having to log in again. And so my code doesn't have a chance to redirect
the user based on role in this case.

I'm thinking the answer would be to modify the default page depending on
the current role, but I'm not sure how to do that. I'm also curious if
anyone has any better ideas.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Nov 11 '07 #3
Kumaran,

(Sorry for the slow reply. I've been trying to work through some of these
issues.)
1. Create a basepage class and have all the pages derive from it. Override
the onpreinit event in the basepage class and add your logic to redirect
users based on thier current roles.
Thanks but I don't believe that will work. Users who are not supposed to
access the default page do not have access to the root folder. Therefore, it
appears they just get taken to the login page even though they are already
logged in and authentication code withing default.aspx would never get a
chance to run. I thought about setting the access-denied page and having
that forward them, but even that won't work because some users will not have
access to the folder that page is in.
2. You can override the onauthenticate event in global.asax file and if
the user is already authenticated and the current requested url is
default.aspx, then apply your logic to redirect appropriately.
Well, I couldn't find any OnAuthenticate event. But there is something like
that. I'll play with that a bit and see if I can make it work.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
>

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>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 the handler for the LoggedIn event of the Login control.

The problem is that users don't always go through the Login control. For
example, if I check the Remember Me box and then disconnect and then
reconnect, I go straight to default.aspx in the root folder withough
having to log in again. And so my code doesn't have a chance to redirect
the user based on role in this case.

I'm thinking the answer would be to modify the default page depending on
the current role, but I'm not sure how to do that. I'm also curious if
anyone has any better ideas.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Nov 14 '07 #4
Mark,

(Sorry for the slow reply. I've been trying to work through some of these
issues.)
Why don't you put a check into the default.aspx page itself? You can check
if the user is currently authenticated and if so, determine where they
should go. Essentially, your default page just becomes a redirecting
agent. The tricky part though is you wouldn't be able to have a normal
default.aspx page since you can't determine whether the person who is
visiting it just returned to the site, or if they have been logged on for
a while and are just navigating around. With the right structure though
this can be a moot point, especially if the default.aspx page isn't
something that they'll hit except when they return to the site.
Thanks but I don't believe that will work. Users who are not supposed to
access the default page do not have access to the root folder. Therefore, it
appears they just get taken to the login page even though they are already
logged in and authentication code withing default.aspx would never get a
chance to run. I thought about setting the access-denied page and having
that forward them, but even that won't work because some users will not have
access to the folder that page is in.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:Ov**************@TK2MSFTNGP05.phx.gbl...
The default page is determined by the web server and not something to be
changed in code. Also, it's good not to mess with the list because it can
affect perormance. The longer the list for example, the longer it takes
IIS to check what is the default page for a directory.

--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>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 the handler for the LoggedIn event of the Login control.

The problem is that users don't always go through the Login control. For
example, if I check the Remember Me box and then disconnect and then
reconnect, I go straight to default.aspx in the root folder withough
having to log in again. And so my code doesn't have a chance to redirect
the user based on role in this case.

I'm thinking the answer would be to modify the default page depending on
the current role, but I'm not sure how to do that. I'm also curious if
anyone has any better ideas.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Nov 14 '07 #5
Hi Jonathan,

As I mentioned in your other thread, I think the real problem is that you
have restricted access to the default page in the root folder. IMO it would
be best to redesign your site such that all users have access to the root
folder and move any pages that need to be secured into sub-folders.

Scott

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:uf**************@TK2MSFTNGP02.phx.gbl...
Users who are not supposed to access the default page do not have access
to the root folder.
Nov 15 '07 #6
Yeah, I haven't come up with anything better. However, now I'm wondering if
I can make access to Default.aspx global but keep other files in the root
folder restricted. This way, all users can access Default.aspx but the
primary users will still use the root folder.

Now I just need to determine if ASP.NET will allow me to allow all users to
access a single file in a folder but not any other files...

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Scott Roberts" <sr******@webworks-software.comwrote in message
news:Ol**************@TK2MSFTNGP05.phx.gbl...
Hi Jonathan,

As I mentioned in your other thread, I think the real problem is that you
have restricted access to the default page in the root folder. IMO it
would be best to redesign your site such that all users have access to the
root folder and move any pages that need to be secured into sub-folders.

Scott

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:uf**************@TK2MSFTNGP02.phx.gbl...
>Users who are not supposed to access the default page do not have access
to the root folder.
Nov 15 '07 #7
And I found I am able to allow global access to Default.aspx but not other
files in the root folder. I'm pretty sure I'll go with some variation on
that!

Thanks agian.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Scott Roberts" <sr******@webworks-software.comwrote in message
news:Ol**************@TK2MSFTNGP05.phx.gbl...
Hi Jonathan,

As I mentioned in your other thread, I think the real problem is that you
have restricted access to the default page in the root folder. IMO it
would be best to redesign your site such that all users have access to the
root folder and move any pages that need to be secured into sub-folders.

Scott

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:uf**************@TK2MSFTNGP02.phx.gbl...
>Users who are not supposed to access the default page do not have access
to the root folder.
Nov 15 '07 #8

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

Similar topics

86
by: Michael Kalina | last post by:
Because when I asked for comments on my site-design (Remember? My site, your opinion!) some of you told me never to change anything on font-sizes! What do you guys think of that:...
1
by: Mauricio | last post by:
Hi, I´m building an application that uses Forms Authentication. By default, when I enter into the application without specifing a file, the default page that is loaded after the logon...
8
by: DanB | last post by:
This is probably soooo simple but I can't seem to get it. I have a text file that I want users to download via a web page. I want the file to be saved to a default folder (or one that they...
9
by: Harry Smith | last post by:
While reading the documentation on IsStartupScriptRegistered, there is a reference to "client startup script" as "Determines if the client startup script is registered with the Page object." What...
2
by: Daves | last post by:
I want to have another default page than the default.aspx, can I change this in web.config?
2
by: dbuchanan | last post by:
What determines if .NET builds an EXE or a DLL file. (My NUnit testfixture needs a reference to my dll file, but my applicaiton builds an exe file.)
10
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...
3
by: brianflannery | last post by:
Greetings all! My problem is this. I've installed a new printer on my computer. This is the "default printer" for access. Now, some of my reports, which were working fine with the old printer,...
2
by: yogarajan | last post by:
Hi four months ago I was developed one web site. That website default page is index.htm. Now am create one flash intro page that page called intro.html how can i change my default page index.htm...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.