Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 572789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:39:19+00:00 2026-05-13T13:39:19+00:00

I have a C# application that has links to certain features on a web

  • 0

I have a C# application that has links to certain features on a web application that uses the same login credentials. If the user has logged in using the application and they click a link, a new browser window opens (usually IE but may be just the default browser) and asks the them to authenticate again.

Is there a way to make the account stay logged in whether it is in the C# application or in a separate browser window? The web application uses cookies to store the users session variables for authentication, the C# application has the same session info but not in a cookie.

Essentially I need to create a cookie from the C# application’s session information and pass it to the new browser window.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:39:19+00:00Added an answer on May 13, 2026 at 1:39 pm

    I believe any new window instance will start a new session and therefore wipe out any session cookies you may have created prior to opening a new browser through either Process.Start("iexplorer.exe", "www.msn.ca") or webBrowser1.Navigate("www.msn.ca", true).

    However I finally found a work around for this problem. It involves the following:

    1. Create your own web browser that looks almost exactly like Internet Explorer. See the folowing link for code for a basic browser and customize it as needed.

      http://msdn.microsoft.com/en-us/library/ms379558(VS.80).aspx

      I fixed the bug by replacing the obsolete RaftingStrip with the ToolStrip, ToolStripContainer. (Email me if you want this debugged code. I’d post it but I think it’s too long for this forum.)

      For myself, I added

      1. constructor to pass the target url, set it to the Address bar, set it as the home page and also pass the security token

      2. properties to enable/disable the Address bar and Search bars

      3. added Cut, Copy, Paste, SaveAs, and Print buttons

      4. changed the progress icon from “C#” to an hourglass

    2. On the web browser form’s declaration section, add

      DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
      public static extern bool InternetSetCookie(string lpszUrlName,
               string lbszCookieName, string lpszCookieData);
      
    3. On the web browser form load and Create_a_new_tab(), before the webpage.Navigate() insert the lines below that save the token to a session cookie. (This may also be required on the button_go_click and button_search_click events if navigating to a new domain. Personally, I would disable the Address and Search bars if passing a security token.)

      string url = comboBox_url.Text.Trim();  // write the session cookie
      string security_token = "my_session_id=12345" // should have been passed to constructor
      InternetSetCookie(url, null, security_token);
      

    The user will never know the difference and you have control over what features to turn on/off or implement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.