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. General Programming
  3. C#
  4. how to send user ID across differnet application in ASP.Net?

how to send user ID across differnet application in ASP.Net?

Scheduled Pinned Locked Moved C#
csharpasp-netcomwindows-adminsecurity
19 Posts 4 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.
  • G Offline
    G Offline
    George_George
    wrote on last edited by
    #1

    Hello everyone, I have two web applications all are developed by ASP.Net. Now I want to provide a feature which enables the user to click from one URL in application site (one virtual directory of IIS) A to the other URL in application site B (another virtual directory of IIS). I have two ideas to implement them, but both of them have issues. I want to know what solution should be optimum solution? Solution 1: using cookie, so from both application sites, we could retrieve user ID information from reading cookie, but I am afraid if cookie is disabled in browser, this "jump" feature never works. Solution 2: When the user redirects to an URL in another site, I could append user ID after the URL, I could redirect to this URL in another site http://www.anotherapplicationsite.com/somesuburl?userID=foo, but I am afraird that in this way userID will be exposed easily which raise security issues. Any advice? thanks in advance, George

    J M X 3 Replies Last reply
    0
    • G George_George

      Hello everyone, I have two web applications all are developed by ASP.Net. Now I want to provide a feature which enables the user to click from one URL in application site (one virtual directory of IIS) A to the other URL in application site B (another virtual directory of IIS). I have two ideas to implement them, but both of them have issues. I want to know what solution should be optimum solution? Solution 1: using cookie, so from both application sites, we could retrieve user ID information from reading cookie, but I am afraid if cookie is disabled in browser, this "jump" feature never works. Solution 2: When the user redirects to an URL in another site, I could append user ID after the URL, I could redirect to this URL in another site http://www.anotherapplicationsite.com/somesuburl?userID=foo, but I am afraird that in this way userID will be exposed easily which raise security issues. Any advice? thanks in advance, George

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      George_George wrote:

      Solution 1

      Wont work, cookies are only sent to the same domain that created them for obvious security reasons. If both applications resided within the same domain but were, say, subdirectories of that main root then your in with a chance of this solution!

      George_George wrote:

      Solution 2

      Is terribly insecure how you described it. If you have to do it this way, you need to generate something long (like a Guid) for each session and pass this between apps. You MUST make sure these sessions are time limited, and cannot be used after a session has finished. This is no small feat, and requires alot of bespoke code to handle session management, and the criteria for which they can acceptably be passed between 2 apps. One other solution you could consider is using NT Security in both applications, as the currently logged on user is easy to obtain in ASP.NET or a winforms app - this would negate the need for much of your user management code, and allow you to still know who is currently logged in. This solution kind of relies on your applications residing on one network, where all users can be added to your domain server(s). You're getting better at asking questions my old friend ;) This one showed some actual though (and maybe a little research) on your part :omg:

      M G 2 Replies Last reply
      0
      • G George_George

        Hello everyone, I have two web applications all are developed by ASP.Net. Now I want to provide a feature which enables the user to click from one URL in application site (one virtual directory of IIS) A to the other URL in application site B (another virtual directory of IIS). I have two ideas to implement them, but both of them have issues. I want to know what solution should be optimum solution? Solution 1: using cookie, so from both application sites, we could retrieve user ID information from reading cookie, but I am afraid if cookie is disabled in browser, this "jump" feature never works. Solution 2: When the user redirects to an URL in another site, I could append user ID after the URL, I could redirect to this URL in another site http://www.anotherapplicationsite.com/somesuburl?userID=foo, but I am afraird that in this way userID will be exposed easily which raise security issues. Any advice? thanks in advance, George

        M Offline
        M Offline
        musefan
        wrote on last edited by
        #3

        Cookies are not difficult to expose either thou so... what about when a user logs in you create a random key and store that on the server so you can identify the user. That could be passed in the URL and would be different each time Ive never done it, so just a suggestion.

        My opinion is... If someone has already posted an answer, dont post the SAME answer

        G 1 Reply Last reply
        0
        • G George_George

          Hello everyone, I have two web applications all are developed by ASP.Net. Now I want to provide a feature which enables the user to click from one URL in application site (one virtual directory of IIS) A to the other URL in application site B (another virtual directory of IIS). I have two ideas to implement them, but both of them have issues. I want to know what solution should be optimum solution? Solution 1: using cookie, so from both application sites, we could retrieve user ID information from reading cookie, but I am afraid if cookie is disabled in browser, this "jump" feature never works. Solution 2: When the user redirects to an URL in another site, I could append user ID after the URL, I could redirect to this URL in another site http://www.anotherapplicationsite.com/somesuburl?userID=foo, but I am afraird that in this way userID will be exposed easily which raise security issues. Any advice? thanks in advance, George

          X Offline
          X Offline
          Xmen Real
          wrote on last edited by
          #4

          make a database to store that user id or use xml if its just user id... its your choice. SQL Database is more secured

          TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

          G 1 Reply Last reply
          0
          • J J4amieC

            George_George wrote:

            Solution 1

            Wont work, cookies are only sent to the same domain that created them for obvious security reasons. If both applications resided within the same domain but were, say, subdirectories of that main root then your in with a chance of this solution!

            George_George wrote:

            Solution 2

            Is terribly insecure how you described it. If you have to do it this way, you need to generate something long (like a Guid) for each session and pass this between apps. You MUST make sure these sessions are time limited, and cannot be used after a session has finished. This is no small feat, and requires alot of bespoke code to handle session management, and the criteria for which they can acceptably be passed between 2 apps. One other solution you could consider is using NT Security in both applications, as the currently logged on user is easy to obtain in ASP.NET or a winforms app - this would negate the need for much of your user management code, and allow you to still know who is currently logged in. This solution kind of relies on your applications residing on one network, where all users can be added to your domain server(s). You're getting better at asking questions my old friend ;) This one showed some actual though (and maybe a little research) on your part :omg:

            M Offline
            M Offline
            musefan
            wrote on last edited by
            #5

            Could you not just create a hash of the (userID + logginDateTimeString) and store that in database along with an expiary DateTime? - Thats fairly simple

            My opinion is... If someone has already posted an answer, dont post the SAME answer

            J G 2 Replies Last reply
            0
            • M musefan

              Could you not just create a hash of the (userID + logginDateTimeString) and store that in database along with an expiary DateTime? - Thats fairly simple

              My opinion is... If someone has already posted an answer, dont post the SAME answer

              J Offline
              J Offline
              J4amieC
              wrote on last edited by
              #6

              Simple, but fairly easyto brute-force from an (in)security point of view.

              M G 2 Replies Last reply
              0
              • J J4amieC

                Simple, but fairly easyto brute-force from an (in)security point of view.

                M Offline
                M Offline
                musefan
                wrote on last edited by
                #7

                then throw in a salt value. it would take a while to brute force attack it anyway. plus the only valuable info in the hash would be a userID value i.e. 1, 34 or 103 which is useless if it cannot be used anywhere. no?

                My opinion is... If someone has already posted an answer, dont post the SAME answer

                G 1 Reply Last reply
                0
                • J J4amieC

                  George_George wrote:

                  Solution 1

                  Wont work, cookies are only sent to the same domain that created them for obvious security reasons. If both applications resided within the same domain but were, say, subdirectories of that main root then your in with a chance of this solution!

                  George_George wrote:

                  Solution 2

                  Is terribly insecure how you described it. If you have to do it this way, you need to generate something long (like a Guid) for each session and pass this between apps. You MUST make sure these sessions are time limited, and cannot be used after a session has finished. This is no small feat, and requires alot of bespoke code to handle session management, and the criteria for which they can acceptably be passed between 2 apps. One other solution you could consider is using NT Security in both applications, as the currently logged on user is easy to obtain in ASP.NET or a winforms app - this would negate the need for much of your user management code, and allow you to still know who is currently logged in. This solution kind of relies on your applications residing on one network, where all users can be added to your domain server(s). You're getting better at asking questions my old friend ;) This one showed some actual though (and maybe a little research) on your part :omg:

                  G Offline
                  G Offline
                  George_George
                  wrote on last edited by
                  #8

                  Thanks J4amieC, One more question about your reply, "If both applications resided within the same domain but were, say, subdirectories of that main root then your in with a chance of this solution!" -- what do you mean this? Could you show me a sample please? Sorry I read a couple of times but can not understand what do you mean. For other parts of your reply, they are so great and I think I understand. :-) regards, George

                  1 Reply Last reply
                  0
                  • M musefan

                    Could you not just create a hash of the (userID + logginDateTimeString) and store that in database along with an expiary DateTime? - Thats fairly simple

                    My opinion is... If someone has already posted an answer, dont post the SAME answer

                    G Offline
                    G Offline
                    George_George
                    wrote on last edited by
                    #9

                    Good solution, musefan! regards, George

                    1 Reply Last reply
                    0
                    • J J4amieC

                      Simple, but fairly easyto brute-force from an (in)security point of view.

                      G Offline
                      G Offline
                      George_George
                      wrote on last edited by
                      #10

                      Then what is your better solution? regards, George

                      1 Reply Last reply
                      0
                      • M musefan

                        then throw in a salt value. it would take a while to brute force attack it anyway. plus the only valuable info in the hash would be a userID value i.e. 1, 34 or 103 which is useless if it cannot be used anywhere. no?

                        My opinion is... If someone has already posted an answer, dont post the SAME answer

                        G Offline
                        G Offline
                        George_George
                        wrote on last edited by
                        #11

                        "then throw in a salt value. it would take a while to brute force attack it anyway." -- intersted in this, could you show me what do you mean salt value please? :-) happy weekend, George

                        M 1 Reply Last reply
                        0
                        • M musefan

                          Cookies are not difficult to expose either thou so... what about when a user logs in you create a random key and store that on the server so you can identify the user. That could be passed in the URL and would be different each time Ive never done it, so just a suggestion.

                          My opinion is... If someone has already posted an answer, dont post the SAME answer

                          G Offline
                          G Offline
                          George_George
                          wrote on last edited by
                          #12

                          Cool, musefan! "Cookies are not difficult to expose either thou" -- could you show me more information please? Any documents or your experience proves some ways to expose cookie information? regards, George

                          M 1 Reply Last reply
                          0
                          • X Xmen Real

                            make a database to store that user id or use xml if its just user id... its your choice. SQL Database is more secured

                            TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

                            G Offline
                            G Offline
                            George_George
                            wrote on last edited by
                            #13

                            Why cookie is not secured? regards, George

                            X 1 Reply Last reply
                            0
                            • G George_George

                              Why cookie is not secured? regards, George

                              X Offline
                              X Offline
                              Xmen Real
                              wrote on last edited by
                              #14

                              cookies saves on client side. And server side is more secure than client side

                              TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

                              G 1 Reply Last reply
                              0
                              • X Xmen Real

                                cookies saves on client side. And server side is more secure than client side

                                TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

                                G Offline
                                G Offline
                                George_George
                                wrote on last edited by
                                #15

                                Thanks, Xmen! I agree with you on server side is more secure. But I think cookie is encrypted on client side always? So, it should also be ok? regards, George

                                X 1 Reply Last reply
                                0
                                • G George_George

                                  Thanks, Xmen! I agree with you on server side is more secure. But I think cookie is encrypted on client side always? So, it should also be ok? regards, George

                                  X Offline
                                  X Offline
                                  Xmen Real
                                  wrote on last edited by
                                  #16

                                  dude, encryption can be cracked easily.

                                  TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

                                  G 1 Reply Last reply
                                  0
                                  • X Xmen Real

                                    dude, encryption can be cracked easily.

                                    TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

                                    G Offline
                                    G Offline
                                    George_George
                                    wrote on last edited by
                                    #17

                                    Hi Xmen, Could you show me how unsecure even if we encrypt cookie at client side? Either your experience or other documents are fine. Previous I fully trust encrypted cookie is secure and very hard (not impossible) to hack. :-) regards, George

                                    1 Reply Last reply
                                    0
                                    • G George_George

                                      "then throw in a salt value. it would take a while to brute force attack it anyway." -- intersted in this, could you show me what do you mean salt value please? :-) happy weekend, George

                                      M Offline
                                      M Offline
                                      musefan
                                      wrote on last edited by
                                      #18

                                      a salt is basically just a static string that you append to other information before hashing i.e. string salt = "SALTVALUE"; string password = "PASSWORD"; string combined = salt + password; Hash(Combined); now the hashed value is not simply the password, so it makes it harder to crack

                                      My opinion is... If someone has already posted an answer, dont post the SAME answer

                                      1 Reply Last reply
                                      0
                                      • G George_George

                                        Cool, musefan! "Cookies are not difficult to expose either thou" -- could you show me more information please? Any documents or your experience proves some ways to expose cookie information? regards, George

                                        M Offline
                                        M Offline
                                        musefan
                                        wrote on last edited by
                                        #19

                                        well you can use the WebBrowser control, then view the cookies with the following WebBrowser.Document.Cookie //this is a string of cookies for the loaded page, they are split with ;

                                        My opinion is... If someone has already posted an answer, dont post the SAME answer

                                        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