Default.aspx - newbie Q`

  • Thread starter Thread starter Colin Basterfield
  • Start date Start date
C

Colin Basterfield

Hi,

My ASP.NET has Forms Authentication set up to use a login page, all
configured in the web.config. I am in the process of trying to get it
running on the site but have come across some problems. It all worked but
if you didn't type in www.mywebsite.com/login.aspx it didn't go to the login
page. Once authenticated it goes to a selection screen, but this is called
selection.aspx, so I thought if I renamed the selection.aspx to default.aspx
it would then work if the user typed in www.mywebsite.com but it tries to go
there automatically seemingly w/out taking any notice of the authentication
set up, i.e go to login first.

Am I missing something here? Is it my login page that should be called
default, but no documentation I have yet read does or even suggests this
practice.

So I'm confused, any ideas please
TIA
Colin
 
It will try to go to the page specified in the IIS manager first.
If you have the AUTH setup in the web.config to not allow access to this
page it should redirect to the login page specified in the web.config. After
proper authentication have it redirect back to the URL specified in the
QueryString.
 
Hi Curt,

Firstly thanks, secondly just to clarifymy understanding:

Currently I set it back to how it originally worked. I have
<!--
<authentication mode="Forms">
<forms name="SiteSummAuth" loginUrl="Login.aspx" path="/" />

</authentication>

<authorization>

<deny users="?" />

</authorization>

-->

set up in my web.config, and I have sselection.aspx as my start page, but because of the config it goes to login.aspx, so provided you type in the browser www.mywebsite.com/login.aspx it works fine. With the correct username and password you get to the selection.aspx, because the login does a redirect to it, and that is fine, and beyond.

I want to have the users be able to just type www.mywebsite.com and it go to the login.aspx screen if not already authenticated or direct to selection.aspx if authenticated

As an aside when I set a page to be the start page in my solution/project where does that information get stored? What gets stored in the app that I upload thro FTP to my host that tells it which page is the start page? Are there any docs/tutorials about this because I am so green about this part of ASP.NET development...

thanks again

Colin
 
if the selected.aspx is the default page then that's where they'll go, if
authenticated... the thing is that you have FORMS auth, if they just opened
their browser, they aren't authenticated, so they'll get sent to
login.aspx... Am I missing something...isnt' it acting EXACTLY as it should?

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


Hi Curt,

Firstly thanks, secondly just to clarifymy understanding:

Currently I set it back to how it originally worked. I have
<!--
<authentication mode="Forms">
<forms name="SiteSummAuth" loginUrl="Login.aspx" path="/" />

</authentication>

<authorization>

<deny users="?" />

</authorization>

-->

set up in my web.config, and I have sselection.aspx as my start page, but
because of the config it goes to login.aspx, so provided you type in the
browser www.mywebsite.com/login.aspx it works fine. With the correct
username and password you get to the selection.aspx, because the login does
a redirect to it, and that is fine, and beyond.

I want to have the users be able to just type www.mywebsite.com and it go to
the login.aspx screen if not already authenticated or direct to
selection.aspx if authenticated

As an aside when I set a page to be the start page in my solution/project
where does that information get stored? What gets stored in the app that I
upload thro FTP to my host that tells it which page is the start page? Are
there any docs/tutorials about this because I am so green about this part of
ASP.NET development...

thanks again

Colin
 
No it's me not explaining myself very well.

OK, I'll try another way. Is it reasonable to expect the user to have to
type in the whole path,

e.g. www.mywebsite.com/selection.aspx ?

The point is at the moment if the User only types www.mywebsite.com they get
a 'You are not authorised to view this page' error message.

So my question is what do/can I do to remove that rather unfriendly message
and replace it with something that takes then straight to the login page.

So you are correct it is doing what it should, but I want to make the whole
rather more friendly.

Thanks for your patience, we live in the South Island of New Zealand and
there aren't many folk who I can bounce these things around with, so I am
mightily grateful for these newsgroups, that's for sure.!

Cheers
Colin
 
Ahhh..... I see now.
You are saying that they AREN'T getting redirected to the login page when
then first hit the site....
I'd suggest reversing your system.
Set the login.aspx as the default page, but have the PAGE_LOAD do a auth
check and redirect to the ReturnURL or Selected.aspx depending on the case.
I mean no one will ever hit the Selected.aspx when its default without first
hitting the login.aspx anyway.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
 
Hi,

OK, did that but I still can't type in www.mywebsite.com in the browser and
get anything other than an unauthorised access error.

Thanks for your input however, I will check with the host in case there is
something wrong there.

Cheers
Colin
 
Hi,

I went out kitesurfing, but when I got back fixed the problem, so that the
login page comes up even if you type in just the url worth nothing on the
end. I renamed my login.aspx to default.aspx and it works fine. Obviosuly
the whole thing needs work but now I am up and running I can refactor
etc...or start again when the client sees it! :-)

thanks for your help
Colin
 
Back
Top