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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:45:53+00:00 2026-06-15T00:45:53+00:00

I have developed a HTML/Jquery Mobile app which works by getting data from a

  • 0

I have developed a HTML/Jquery Mobile app which works by getting data from a REST web service I have written using MVC3. At the moment the service is open and all is well with the world. However I have to implement some kind of authentication to secure the service so I have users sign up via the mobile app. What I intend to do is use the [Authorize] attribute on my Controller or Actions to implement ASP.NET membership etc.
My question the is

  • How do I get the client which communicates via jquery to call this secure service
  • Is ASP.NET membership the best way to go about this or is there some other type of security I could implement

A tutorial or blog with some sample code would suffice and I will do well to post the solution here as soon as I get it right.

Thanks and feel free to ask any questions you might have about this.

  • 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-15T00:45:55+00:00Added an answer on June 15, 2026 at 12:45 am

    Take a look at this Q&A which describes creating a custom AuthorizeAttribute for Web API that also authenticates the user using http basic authentication and grabbing the credentials from the HTTP header. Note that there is a different AuthorizeAttribute for ASP.NET Web API (System.Web.Http.AuthorizeAttribute) as opposed to the one for an MVC controller (System.Web.Mvc.AuthroizeAttribute). They have different behaviors. You do not want a call to a Web API being redirected to a logon page.

    The code on the client side would look something like this to call the REST web service.

       getAuthorizationHeader = function (username, password) {
        var up = $.base64.encode(username + ":" + password);
        authType = "Basic " + up;
        return authType;
       },
    
    
        $.ajax({
            url: _url,
            data: _data,
            type: _type,
            beforeSend: function (xhr) {
                xhr.setRequestHeader("Authorization", getAuthorizationHeader(username, password));
    
            },
            success: ajaxSuccessHandler,
            error: ajaxErrHandler
        });
    

    The beforeSend event is used to put the credentials in the HTTP header. You still want to use HTTPS/SSL to make this secure. Just encoding the username/password is not enough security.

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

Sidebar

Related Questions

I have developed a HTML application which uses JQuery to get the data from
I have a simple app developed with jQuery Mobile and implemented in PhoneGap. It
I have developed android phonegap app using html and jquery.I need to show tooltip
I have developed a html css code. It works perfect on all browsers but
I have recently developed my first mobile web application using HTML5, CSS3, JavaScript and
I have developed a PopupMenu using a jQuery plugin. When the HTML button is
I have developed code with Ajax and jQuery. I have got a response from
I'm using HTML+JQuery as UI, Spring-Roo to generate service layer which contains Json object
I have developed a jQuery API browser from the raw XML available from http://api.jquery.com/api/
I have developed a script that receives json data from a php script using

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.