Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. please reply me!please hurry up!

please reply me!please hurry up!

Scheduled Pinned Locked Moved ASP.NET
questioncomsales
13 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N non2

    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

    P Offline
    P Offline
    Paul Lyons
    wrote on last edited by
    #4

    Please tell me that you only program as a hobby! :mad:

    Paul Lyons, CCPL
    Certified Code Project Lurker

    J 1 Reply Last reply
    0
    • P Paul Lyons

      Please tell me that you only program as a hobby! :mad:

      Paul Lyons, CCPL
      Certified Code Project Lurker

      J Offline
      J Offline
      Jerry Hammond
      wrote on last edited by
      #5

      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)

      N 1 Reply Last reply
      0
      • J Jerry Hammond

        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)

        N Offline
        N Offline
        non2
        wrote on last edited by
        #6

        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 ?

        1 Reply Last reply
        0
        • N non2

          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

          N Offline
          N Offline
          Noman Nadeem
          wrote on last edited by
          #7

          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:

          N 1 Reply Last reply
          0
          • N non2

            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

            A Offline
            A Offline
            Anonymous
            wrote on last edited by
            #8

            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.

            N 1 Reply Last reply
            0
            • N Noman Nadeem

              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:

              N Offline
              N Offline
              non2
              wrote on last edited by
              #9

              thank you nadeem! is it the best way?is not better to use the web.config ?i llok for the standard way?

              1 Reply Last reply
              0
              • A Anonymous

                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.

                N Offline
                N Offline
                non2
                wrote on last edited by
                #10

                what means the unload function?

                N 1 Reply Last reply
                0
                • N non2

                  what means the unload function?

                  N Offline
                  N Offline
                  Noman Nadeem
                  wrote on last edited by
                  #11

                  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:

                  A 1 Reply Last reply
                  0
                  • N Noman Nadeem

                    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:

                    A Offline
                    A Offline
                    Anonymous
                    wrote on last edited by
                    #12

                    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..........

                    N 1 Reply Last reply
                    0
                    • A Anonymous

                      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..........

                      N Offline
                      N Offline
                      Noman Nadeem
                      wrote on last edited by
                      #13

                      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:

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups