please reply me!please hurry up!
-
in my site i want to do this: the customer to enter to the shopping page must redirected to the login page from the home page. after do this if he/she came back to the home (before closing explorer) iwant he/she directly redirected to the shopping page not login page.how can i do this? can i use session state? do i need to configure the web.config?how? Rohollahmahmoodiany@yahoo.com
non2 wrote: do i need to configure the web.config?how? Take a deep breath and head on over to the appropriate forum[^]. Ryan
-
in my site i want to do this: the customer to enter to the shopping page must redirected to the login page from the home page. after do this if he/she came back to the home (before closing explorer) iwant he/she directly redirected to the shopping page not login page.how can i do this? can i use session state? do i need to configure the web.config?how? Rohollahmahmoodiany@yahoo.com
-
in my site i want to do this: the customer to enter to the shopping page must redirected to the login page from the home page. after do this if he/she came back to the home (before closing explorer) iwant he/she directly redirected to the shopping page not login page.how can i do this? can i use session state? do i need to configure the web.config?how? Rohollahmahmoodiany@yahoo.com
Please tell me that you only program as a hobby! :mad:
Paul Lyons, CCPL
Certified Code Project Lurker -
Please tell me that you only program as a hobby! :mad:
Paul Lyons, CCPL
Certified Code Project LurkerI do. Jerry-one-of-the-great-unwashed-hobbiest! Most people are willing to pay more to be amused than to be educated--Robert C. Savage, Life Lessons Toasty0.com Ladder League (beta)
-
I do. Jerry-one-of-the-great-unwashed-hobbiest! Most people are willing to pay more to be amused than to be educated--Robert C. Savage, Life Lessons Toasty0.com Ladder League (beta)
Explain: The problem is : for example the registered user want to enters the shopping form from the home.at the first time he is redirected to the login.aspx form .for example if he for the second time (before closing the explorer )came back to the home and wants to enters the shopping form he must directly redirected to the shopping form not login.aspx. how i can undrastand that the user has logon at first and he want to enter the shopping form for the second. can i use session state?how i cunfigure the web.config ?
-
in my site i want to do this: the customer to enter to the shopping page must redirected to the login page from the home page. after do this if he/she came back to the home (before closing explorer) iwant he/she directly redirected to the shopping page not login page.how can i do this? can i use session state? do i need to configure the web.config?how? Rohollahmahmoodiany@yahoo.com
you can use session state upon FIRST successful login save user variables, e.g. username, passwd, server, logintime, blah blah. return to calling page of login.aspx (i'm assuming u know how!) on your shopping page
Page_Load
check if session variables are present.try
{
// if your Session["username"] does not exist, it will throw exception
// if it is empty or null, we throw our own exception
if ( null == Session["username"] || "" == Session["username"].ToString() )
throw new Exception();}
catch
{
// on exception - meaning not logged on or timed out
Response.Redirect("login.aspx?returl=...", true);
}Take care though, session has expiry for idle time. e.g. you cannot login and come back after an hour and expect the values to be saved. If you need more help, don't hesistate :) Of course, another approach is to use cookies (which are stored on the client machine as apposed to the session) Hope this was what you were looking for. If anyone has a better solution I would love to hear it. regards, Noman Nadeem :zzz:
-
in my site i want to do this: the customer to enter to the shopping page must redirected to the login page from the home page. after do this if he/she came back to the home (before closing explorer) iwant he/she directly redirected to the shopping page not login page.how can i do this? can i use session state? do i need to configure the web.config?how? Rohollahmahmoodiany@yahoo.com
store a guid in a database and use this as a session to put into a cookie or a querystring. on the onload function check tosee if there is a session in the cookie (or query string) and if so redirect them to the apropriate page. otherwise direct them to log on.
-
you can use session state upon FIRST successful login save user variables, e.g. username, passwd, server, logintime, blah blah. return to calling page of login.aspx (i'm assuming u know how!) on your shopping page
Page_Load
check if session variables are present.try
{
// if your Session["username"] does not exist, it will throw exception
// if it is empty or null, we throw our own exception
if ( null == Session["username"] || "" == Session["username"].ToString() )
throw new Exception();}
catch
{
// on exception - meaning not logged on or timed out
Response.Redirect("login.aspx?returl=...", true);
}Take care though, session has expiry for idle time. e.g. you cannot login and come back after an hour and expect the values to be saved. If you need more help, don't hesistate :) Of course, another approach is to use cookies (which are stored on the client machine as apposed to the session) Hope this was what you were looking for. If anyone has a better solution I would love to hear it. regards, Noman Nadeem :zzz:
-
store a guid in a database and use this as a session to put into a cookie or a querystring. on the onload function check tosee if there is a session in the cookie (or query string) and if so redirect them to the apropriate page. otherwise direct them to log on.
-
he means the Page_Load function ! Directly using sessions is not a good idea if you are expecting huge clientelle (users). Cookies and Databases are the way to go, if you expect heavy traffic on your pages. regards, Noman Nadeem :zzz:
-
he means the Page_Load function ! Directly using sessions is not a good idea if you are expecting huge clientelle (users). Cookies and Databases are the way to go, if you expect heavy traffic on your pages. regards, Noman Nadeem :zzz:
I want to use the below code: The Code Project - Cookieless ASP_NET forms authentication - ASP_NET but i do not now where to put these code in the web.config(what tag from this file): 1:the code started by http://localhost.... 2:The code started by :string url..........
-
I want to use the below code: The Code Project - Cookieless ASP_NET forms authentication - ASP_NET but i do not now where to put these code in the web.config(what tag from this file): 1:the code started by http://localhost.... 2:The code started by :string url..........
I do not think that you can have a cookieless forms authentication. What you can do is not keep the cookie persistent, i.e. not save after user logs off. in order to use forms authentication change the authentication tag in the we.config: you will be redirected to login.aspx page automatically ! cookieName needs to be unique for every application running. If you do not supply the "name" attribute, default value is assigned. change the authorization tag as follows: In your global.asax file use the Application_AuthenticateRequest function string cookieName = FormsAuthentication.FormsCookieName; HttpCookie authCookie = Context.Request.Cookies[cookieName]; . . . If you need more help, search for "ASP.NET forms authentication" on MSDN. regards, Noman Nadeem :zzz: