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

  • Home
  • SEARCH
  • 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 8124569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:29:41+00:00 2026-06-06T06:29:41+00:00

I have a small conundrum where I have an asp.net application that’s using forms

  • 0

I have a small conundrum where I have an asp.net application that’s using forms based authentication. Inside of the application, I have a webservice that checks User.IsInRole(“somerole”) which works fine with ajax calls from the application since the user is logged in, and the ajax calls come from his logged in browser.

Now, I want to make a fat client call the webservices (c# console client for starters), but cant figure out how to pass the credential information to it.

I’ve looked at doing something like the following to no avail:

SomeWebService svc = new SomeWebService();
svc.Credentials = new NetworkCredential("formsusername","formspassword","");
String returnValue = svc.CallMyWebMethod();

Can anyone out there show me the trick to this? 🙂

Thanks!

  • 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-06-06T06:29:42+00:00Added an answer on June 6, 2026 at 6:29 am

    Forms Authentication works by having the client send a Cookie along each request. This cookie is emitted by the server when the client successfully authenticates by sending the correct credentials.

    So here are the steps that you need to do in your console application in order to authenticate the user using forms authentication:

    1. Send an HTTP POST request to some web page passing the username and password. In response the web server will give you the authentication cookie (Set-Cookie HTTP response header) that you need to capture. That’s usually your Log page.
    2. When calling your web service you need to pass this cookie (Cookie HTTP request header). In order to set a cookie along with the request, you will have to override the GetWebRequest method on the client proxy class that was generated for you:

      protected override WebRequest GetWebRequest(Uri uri)
      {
          var request = (HttpWebRequest)base.GetWebRequest(uri);
      
          request.CookieContainer.Add(
              new Cookie(
                  ".ASPXAUTH", 
                  "THE VALUE YOU HAVE RETRIEVED WHEN YOU SEND YOUR FIRST LOGON REQUEST"
              )
          );
      
          return request;
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small application that is uploading pictures to another website via webservice. My
I have small application using JSF 1.1. It is using NTLM for authentication. What
I have small application: http://jsfiddle.net/Bwdf6/4/ But with click on delete, tags that created after
I am looking at doing a small web application for learning purposes, using .NET.
A little back story : I have small application that will use Word to
I have small problem with my .net 2.0 winforms application. I want to embed
i have small problems with asp:Repeater. I am printing <ol><li> tags inside repeater in
I have small question. When I started to programm my application, I grouped types
I have small database of business and their addresses. Using the Google Geocode API
I have small web app that generate PDF files as a report. I'm trying

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.