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 4080212
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:54:04+00:00 2026-05-20T17:54:04+00:00

I’m making a wrapper for a forum API, one function returns this, which is

  • 0

I’m making a wrapper for a forum API, one function returns this, which is meant to provide enough information for you to set a cookie to log the user in with:

<?xml version="1.0" encoding="utf-8" ?>    
<ApiResponse>    
 <ErrorCode>0</ErrorCode>    
 <ErrorDescription/>    
 <ResultData recordcount="1">    
  <Record>  
   <Username>Gullanian</Username>    
   <UserID>4</UserID>    
   <CookieName>WWF9sLID</CookieName>    
   <CookieKey>UID</CookieKey>    
   <CookieData>Gullanian-CD45-ZCB-D72Z-AAC6</CookieData>    
   <CookiePath>/scirranew/forum/</CookiePath>
   <ForumPath>http://127.0.0.1/scirranew/Forum/</ForumPath> 
  </Record>    
 </ResultData>    
</ApiResponse>

I’ve got as far as this:

public class WebWizCookie
{
    public string Username { get; set; }
    public int UserID { get; set; }
    public string CookieName { get; set; }
    public string CookieKey { get; set; }
    public string CookieData { get; set; }
    public string CookiePath { get; set; }
    public string ForumPath { get; set; }

    /// <summary>
    /// Loads this cookie so user is logged in with this cookie data.
    /// </summary>
    public void LoadCookie(double MinutesExpiry)
    {
        HttpCookie Cookie = new HttpCookie(this.CookieName);
        Cookie[this.CookieKey] = this.CookieData;
        Cookie.Domain = this.CookiePath;
        Cookie.Expires = DateTime.Now.AddMinutes(MinutesExpiry);

        HttpContext.Current.Response.Cookies.Add(Cookie);
    }

It’s returning all the values fine, but I’m not being logged into the site when I call this function. Does anyone know if I’m doing anything wrong here? Forgetting to set something, or setting it incorrectly?

Edit, printing out values

After setting the cookie, if I print out the values:

HttpContext.Current.Response.Write("Cookie[" + this.CookieKey + "] = " + this.CookieData + "<br />");
HttpContext.Current.Response.Write("Cookie.Domain = " + ConfigurationSettings.AppSettings["MasterDomainRoot"] + "<br />");

I get:

Cookie[UID] = Gullanian2-4B9B-9D5-27E2-A413
Cookie.Domain = http://localhost/ScirraNew
UID

And in google chrome the developer tools says there is a cookie:

enter image description here

  • 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-20T17:54:05+00:00Added an answer on May 20, 2026 at 5:54 pm

    Your Cookie.Domain is wrong. See HttpCookie.Domain on MSDN – it should merely contain the domain (e.g. “localhost”) not the full path (“http://localhost/ScirraNew”). There is a Path property if you want to restrict a cookie to only certain parts of your site, but that is a rarely-used feature (I’ve never come across a reason to do it).

    By the way, you don’t need to set the Domain property – by default, cookies are shared by all pages that are in the same domain. You really only need to set it if you have to share cookies between different subdomains (e.g. http://www.mysite.com and secure.mysite.com, you’d need to set Domain to “mysite.com”)

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into

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.