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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:00:17+00:00 2026-05-21T03:00:17+00:00

I am testing an aspx page I wish to use to post to but

  • 0

I am testing an aspx page I wish to use to post to but I cannot seem to send the certificate over with the data. Here is my client code:

System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
string postData = "age=23&state=47";
byte[] data = encoding.GetBytes(postData);
X509Certificate x509certificate = X509Certificate.CreateFromCertFile(@"C:\Documents and Settings\rcimbalo\My Documents\Downloads\SSL Certificates\testCert.cer");
string key = x509certificate.GetPublicKeyString();
string certData = Encoding.ASCII.GetString(x509certificate.Export(X509ContentType.Cert));
string pks12 = Encoding.ASCII.GetString(x509certificate.Export(X509ContentType.Pkcs12));
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost:3493/Index.aspx");
myRequest.Credentials = new NetworkCredential("xxxx", "yyyy");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
myRequest.ClientCertificates.Add(x509certificate);
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
System.IO.StreamReader st = new StreamReader(((HttpWebResponse)myRequest.GetResponse()).GetResponseStream());
Console.Write(st.ReadLine());

and here is the code from my aspx page:

protected void Page_Load(object sender, EventArgs e)
{
if (this.CheckCredentials())
{
    string data = this.Context.Request.Form.ToString();
}
}

private bool CheckCredentials()
{
    string userName = User.Identity.Name;
    HttpClientCertificate certificate = Request.ClientCertificate;
    if (certificate.IsPresent)
    {
        string w = certificate.Get("SUBJECT 0");
        return true;
    }
    return false;
}

There is never a certificate present.

I found this earlier post
X509Certificate not getting transmitted to the server

But did not understand the answer. I created a certificate using the MakeCert.exe utility but I do not really understand why it does not work.

  • 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-21T03:00:18+00:00Added an answer on May 21, 2026 at 3:00 am

    A client certificate is sent over a SSL connection (https://….). This is not possible with the built in asp.net development server, but is possible if you use the new IIS Express or a local IIS instance.

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

Sidebar

Related Questions

I'm testing a very simple aspx page on Visual Studio's own ASP.NET Development Server(the
Hope somebody can help. Have looked around on the net but cannot seem to
I am playing with an MSDN sample to do memory stress testing (see: http://msdn.microsoft.com/en-us/magazine/cc163613.aspx
Testing.BSMain, Text: Start Page I would like to substring the value above and returning
For testing purposes I want to use Jetty 8 to serve only static content.
I'm very new to Sharepoint, I have an aspx page on a Sharepoint site
I am using HTML object in below manner <object id=foo name=foo type=text/html data=mypage.aspx> </object>
like so: GridView1.Attributes.Add(OnRowDataBound, gridView_OnRowDataBound,); Don't want to add anything on the aspx page. Appears
I can't seem to get it to work. Perhaps I'm not even testing it
i found the following article http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx to help me unit test my NHibernate application.

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.