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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:50:34+00:00 2026-05-27T00:50:34+00:00

I’m sending AJAX form from page in http scheme to https url (the domain,

  • 0

I’m sending AJAX form from page in http scheme to https url (the domain, and the appliaction is the same). I use MVC 3 Ajax helper:

@using (Ajax.BeginForm(MVC.Payment.Confirm(), new AjaxOptions
{
    HttpMethod = "Post",
    UpdateTargetId = "myId",
    InsertionMode = InsertionMode.Replace,
    OnBegin = "$('#popupAjaxLoader').show();",
    OnSuccess = "$('#popupAjaxLoader').hide();",
    Url = "https://same.domain/payment/confirm"
}, new { @action = "https://same.domain.com/payment/confirm" }))
{   
...
}

In the application I use forms authentication:

   <forms loginUrl="~/Account/LogOn" timeout="2880" name="MYCOOKIENAME" />

In firebug I can see that the authentication cookie is not sent to the server when submiting the form, so the handler fails (the request need to be authorized).
How can I force Ajax.BegiForm to attach authentication cookie?

UPDATE:

It turned out that the solution given by counsellorben works if there is no need to receive any information back from the ajax request. Sending Ajax POST from HTTP to HTTPS works fine (cookies are not attached, so you have to POST all neccessary data as hidden form fields), but the server response is not accessible for javascript because of Same Origin Policy.
Eventually I had to abandon Ajax and place the form inside iframe referencing HTTPS url which seems to be the ultimate solution for this problem.

  • 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-27T00:50:35+00:00Added an answer on May 27, 2026 at 12:50 am

    Your problem is that this violates the Same Origin Policy. See the response to this question: Same origin policy with same domain, but https.

    UPDATE

    If it is not possible to make the entire portal use HTTPS, then the alternative is to use a different authentication scheme for your AJAX form submission.

    I would suggest creating a GUID token for the AJAX form, storing the GUID in your repository along with (1) its creation time and (2) the ID of the user to which the GUID was assigned. Then pass the GUID in a hidden field on your AJAX form.

    Remove the [Authorize] attribute from the action being called via the AJAX form, and instead check in your action that a GUID is passed, the GUID is valid, and it has not expired (setting an expiration time of 20 minutes, or whatever is valid under these circumstances). Use the GUID token to identify your user, and proceed as necessary.

    Also, you should have some method to purge expired GUID tokens.

    This should provide adequate security, since the GUID token is issued to an authorized user, and identifies the user submitting the AJAX form. It also permits you to use HTTPS only for the AJAX form submission, since you are no longer relying on the authentication cookie being passed.

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

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.