3 basic questions on asp.net

  • Thread starter Thread starter Wiktor Zychla
  • Start date Start date
W

Wiktor Zychla

Hello,

I am an experienced Win.Forms developer and now I am learning ASP.NET
(no ASP background). there are some basic issues I do not understand and
cannot find any satisfable answers.

1. my application is configured to use Welcome.aspx as the default page.
after the succesful login via Forms authentication (user is redirected to
login.aspx) I try to reset the authentication via

FormsAuthentication.SignOut();
Response.Redirect( "login.aspx" );

this, alas, resets the FormsAuthentication.GetRedirectUrl( "userName",
false ); value to "default.aspx" (while beeing "welcome.aspx" for the first
time) and after the login procedure, the user is redirected to
"default.aspx" instead of "welcome.aspx".

the question:
a) how do I control the default page name, so it is not resets to
"default.aspx"?

2. I understand that to have any data shared by several pages I have to use
cookies to store the values. there's a special containter for such data in
the Application object (HttpApplicationState).

Questions:
a) where the typical browser stores these values? I tried to look for a
cookie in the user cookies directory with no success.
b) how to get rid of these values? even the browser restart does not resets
them.


Thanks in advance for your answers.
Wiktor Zychla
 
Wiktor Zychla said:
Hello,

I am an experienced Win.Forms developer and now I am learning ASP.NET
(no ASP background). there are some basic issues I do not understand and
cannot find any satisfable answers.

1. my application is configured to use Welcome.aspx as the default page.
after the succesful login via Forms authentication (user is redirected to
login.aspx) I try to reset the authentication via

FormsAuthentication.SignOut();
Response.Redirect( "login.aspx" );

this, alas, resets the FormsAuthentication.GetRedirectUrl( "userName",
false ); value to "default.aspx" (while beeing "welcome.aspx" for the first
time) and after the login procedure, the user is redirected to
"default.aspx" instead of "welcome.aspx".

Right, the default.aspx is hard coded when you go directly to the login
page.
the question:
a) how do I control the default page name, so it is not resets to
"default.aspx"?

If you find a way, you are doing better than me. I tried changing the
default page in IIS, et al, but this value appears to be hardcoded in the
ASP.NET runtime. I, personally, find this very annoying. Thank you for
reminding me, as I want to put a wish in for ASP.NET 2.0 on this issue.
2. I understand that to have any data shared by several pages I have to use
cookies to store the values. there's a special containter for such data in
the Application object (HttpApplicationState).

Questions:
a) where the typical browser stores these values? I tried to look for a
cookie in the user cookies directory with no success.

There are user cookies and server cookies. User cookies can easily be
blocked, while server cookies cannot. Many items are stored in server
cookies.

In the case of Application state, it is not stored in cookies, as it applies
to the Application, not the session. If you want user specific information,
store in session (is in a cookie) or roll your own user object.
b) how to get rid of these values? even the browser restart does not resets
them.

Restart the application is the best way for App state values. This is not
where you want to store user specific info.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Back
Top