Results 1 to 2 of 2

Thread: Do I have to use WCF to talk securely to jQuery page

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Do I have to use WCF to talk securely to jQuery page

    I want to use jQuery $.Ajax calls to a web server running iis w/.net fw 3.5.

    Seems that you have to use WCF to have an HTTPS: site using web services?

    I'm confused after a lot of reading links - so any help clarifying this would be greatly appreciated.

    Thanks!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    Re: Do I have to use WCF to talk securely to jQuery page

    Hi There,

    I cant answer your query directly regarding https, but with regard to Jquery and the $.ajax call, this is how I have implemented it (perhaps this will start you off).

    within the .aspx page I have the following code:

    Code:
    $.dimScreen(1, 0.4, function () {
                        $('#dimmer').fadeIn();
                        $.ajax({
                            type: "POST",
                            url: "Default.aspx/Process",
                            data: '{lockton: \'' + encodeURI(textArray) + '\',other: \'' + encodeURI(textArrayOther) + '\'}',
                            contentType: 'application/json; charset=utf-8',
                            dataType: 'json',
                            success: function (response) {
                                if (response != null && response.d != null) { alert(response.d); }
                                $.dimScreenStop();
                                location.reload(); },   /* Clear the screen of any completed files that have been moved */
                            error: function (XMLHttpRequest, textStatus, errorThrown) { $.dimScreenStop(); }
                            
                        });
                    });
    You can see my $.ajax method calling the function Process passing data via 2 parameters using Json.

    in the code behind aspx.cs file the function is declared:

    Code:
    [WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json)]
            public static String Process(String lockton,String other)
            {.....
    Also when using https ALL your references need to be set to HTTPS. i.e. <Script> tags in the header need to have their src set specifically to https.
    Last edited by Bill Crawley; Mar 10th, 2011 at 11:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width