Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Unable to POST to MemberImportForm programatically

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 350 Views
  • JeffMcClintock
    Avatar
    Community Member
    1 Post

    Unable to POST to MemberImportForm programatically Link to this post

    Hi All,
    I'm trying to write a program to import new Members via the Security Admin 'Import' page. I'm using the program Fiddler to diagnose the communication. Logging in and navigating to the page seems to work fine, it's posting the form that don't.
    Here's the dump. First: normal browser posting the form succesfully. 2nd: My C# code posting the form using a HttpWebRequest. My code fails to add the new memeber to the Silverstripe database. Any suggestions appreciated. Jeff.

    --Me operating a web browser=====================================================

    POST http://www.synthedit.com/admin/security/MemberImportForm HTTP/1.1
    Accept: text/html, text/html, */*
    Referer: http://www.synthedit.com/admin/security/memberimport
    Accept-Language: en-NZ
    User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
    Content-Type: multipart/form-data; boundary=---------------------------7db2e42c60870
    Accept-Encoding: gzip, deflate
    Host: www.synthedit.com
    Content-Length: 498
    Connection: Keep-Alive
    Pragma: no-cache
    Cookie: __utma=148077877.1849251437.1260424688.1320695175.1320707633.522; __utmz=148077877.1319790845.509.75.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=depends.exe%20site%3Asynthedit.com; __utmx=148077877.; __utmxx=148077877.; __utmb=148077877.1.10.1320707633; __utmc=148077877; PastMember=1; PHPSESSID=dda3e6a592af856c73c1f72d647877ec

    -----------------------------7db2e42c60870
    Content-Disposition: form-data; name="CsvFile"; filename="ImportMe.csv"
    Content-Type: application/vnd.ms-excel

    Email,Password,FirstName,Surname
    keenan@xxx.com,xxx,Keenan,Windel
    -----------------------------7db2e42c60870
    Content-Disposition: form-data; name="MAX_FILE_SIZE"

    -----------------------------7db2e42c60870
    Content-Disposition: form-data; name="action_doImport"

    Import
    -----------------------------7db2e42c60870--

    --My code emulating a web browser=============================================

    POST http://www.synthedit.com/admin/security/MemberImportForm HTTP/1.1
    Content-Type: multipart/form-data; boundary=-----------------------------8ce6c28353f2c3d
    Referer: http://www.synthedit.com/admin/security/memberimport
    Host: www.synthedit.com
    Cookie: PHPSESSID=b3149781439881ab6a69dccff0377460; PastMember=1
    Cache-Control: no-store,no-cache
    Pragma: no-cache
    Content-Length: 506
    Expect: 100-continue

    -----------------------------8ce6c28353f2c3d
    Content-Disposition: form-data; name="CsvFile"; filename="ImportMe.csv"
    Content-Type: application/vnd.ms-excel

    Email,Password,FirstName,Surname
    moose@moose.com,Moose3964,Moosie,Moose
    -----------------------------8ce6c28353f2c3d
    Content-Disposition: form-data; name="MAX_FILE_SIZE"

    -----------------------------8ce6c28353f2c3d
    Content-Disposition: form-data; name="action_doImport"

    Import
    -----------------------------8ce6c28353f2c3d--

    350 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.