Monday, January 29, 2007

HOWTO: POST Resources to IIS

Question:

i'm working on a piece that requires companies to be able to POST data to one another's web sites using just the URL without page name (i.e. http://doc_uploads.partnetsite.com). there's also no need for any kind of web interface at either end, so i can't expect to grab the data from a form field and save to disk. simply put, using an application like CURL, i should be able to execute a command that says "post myFile.txt to http://doc_uploads.partnersite.com".

i need to figure out how to configure doc_uploads.mysite.com to listen for POST commands and start up an application to capture the POST data and save to disk.

i've seen a few articles on how to use microsoft's posting acceptor to do file uploads, but this requires having the user fill in fields on a page which i can't ask the sender to do.

anybody have any idea how to pull this off? i thought i knew IIS pretty well, but this one has me totally stumped.

Answer:

I can think of a few ways to do what you are asking on IIS, and each has its benefits and drawbacks. In no particular order:

  • Use IIsWebFile to configure a specific URL's Default Document to be the POST acceptor.
  • Use ISAPI Filter to rewrite specific incoming URL without page name to URL with the POST acceptor as the page name
  • Enable and use WebDAV PUT

Whichever is "better" depends on which benefit(s)/drawback(s) you require. The benefits and drawbacks of each approach are as follows, in no particular order.

DefaultDocument/IIsWebFile

This solution is simply IIS configuration of the POST acceptor code. It requires IIS6 on Windows Server 2003, and the POST request URL must end with a backslash to invoke the Default Document without needing 302 courtesy redirection for POST support from the client (i.e. client sends POST to http://doc_uploads.partnetsite.com/).

ISAPI Filter

The ISAPI Filter solution requires writing and maintaining C code for the ISAPI Filter, code for the POST acceptor, and IIS configuration for both the ISAPI Filter and POST acceptor code. It works on any IIS version and there are no requirements on the format of the POST request URL.

WebDAV

WebDAV is purely IIS configuration - no POST acceptor nor C code required. It works on all IIS versions that support WebDAV (pretty much all currently supported IIS versions except the latest IIS7 release, but that should be fixed soon), and the request must look like PUT http://doc_uploads.partnetsite.com/myFile.txt and myFile.txt will be available for retrieval by anyone via GET http://doc_uploads.partnetsite.com/myFile.txt UNLESS you control all applications on IIS from inadvertently serving that resource via some mechanism (NTFS ACLs, IIS Access Permissions, etc).

i.e. once you PUT a file to the web server, it can be retrieved via GET. This is different from a POST acceptor which can be configured to store files outside the URL namespace to avoid inadvertent web-based access of those uploaded resources.

Conclusion

I have only provided the categories of solutions possible - the specific solution for your situation requires more details about your requirements. You do not need to worry about user interactivity, FORM fields, grabbing data, Posting Acceptor, etc - all those tasks can be automated. There are many ways to "post myFile.txt to http://doc_uploads.partnersite.com", and you have only scratched the surface of your requirements...

//David

39 comments:

steven said...

many thanks, david.

i'm looking for the "path of lease resistance" on this one as i've got about 1 day to figure this out. as i don't know C and leaving the file on the server available via GET isn't an option, it looks like i'm headed toward "Default Document" option. you mention that the url must end with a backslash. i'm guessing you meant forward slash?

you also mention that this option requires IIS6 on win2003. default document configuration was available on IIS5 and probably was available on earlier verions of IIS. is the default document requirement on IIS6/win2003 different somehow?

if i understand you correctly, if i place a C# applicaiton on the web server named something like "default.aspx" it should kick in when the user POSTS to http://doc_uploads.mysite.com/ and from there i should be able to sniff a POST request and parse out the posted data?

how do i go about implementing the 302 redirect if the user POSTS to http://doc_uploads.mysite.com?

tks again.

David Wang said...

Yes, I meant slash.

The ability to POST to a DefaultDocument requires IIS6. Prior IIS versions will return "405 Method not Allowed". That is simply a limitation of the IIS Request Processing Pipeline.

Yes, ASP.Net page configured as DefaultDocument can sniff the POST request if ASP.Net is enabled on IIS6.

You have no way to control nor be notified of the courtesy 302 redirect because it comes from the IIS Request Pipeline.

If a user POSTs to http://doc_uploads.mysite.com and no ISAPI hijacks the request (as per my ISAPI Filter option), IIS6 will send the 302 redirect (prior versions send 405), and the question is whether the client supports redirected POST. There is nothing you can do on the server.

//David

Anonymous said...

Here is WebDAV server library that work with IIS 7: www.webdavsystem.com

aiyipianni said...

Aston Villa rode their luck at Hull City where an 88-minute own goal from Kamil Zayatte saw them leapfrog three points clear of Arsenal and into fourth place in the Premier League wow gold with a 1-0 win.

Villa had to survive Hull penalty wotlk gold appeals for a handball against Ashley Young in time added on, television replays showing that referee Steve Bennett wow gold correctly rejected the claims after consulting a linesman.

Bennett had been involved in controversy after just five minutes when American goalkeeper Brad Friedel looked to have handed Hull the initiative and threaten Villa's return to the Champions League qualifying wow gold zone.

Friedel spilled wow gold the ball under pressure from Nick Barmby and stand-in right-back Nigel Reo-Coker turned it into his own net as he attempted to wow gold clear.

But Bennett cut short wow gold celebrations at the KC Stadium -- and let Friedel off the hook -- when he ruled out the score for an wow wotlkapparent infringement by Barmby.

Zayatte's intervention from a Young cross bound for wow gold Gabriel Agbonlahor then saw Villa leapfrog Arsenal and draw level with Manchester United on 38 points -- seven adrift of leaders Liverpool and four wow gold behind Chelsea.

Stung by an on-pitch dressing down wow gold by manager Phil Brown at Manchester City last week, Hull showed five changes and a vastly improved performance.

Promoted Hull were looking for only their second win in 11 games while wow gold Villa arrived unbeaten in seven and it looked to be heading for a goalless draw when the home side suffered a cruel late blow.

aiyipianni said...

Premier League leaders Liverpool thrrew their "full support" world of warcraft gold behind Steven Gerrard after their captain was charged with assault on Tuesday following an incident at a local nightclub.

Gerrard, 28, and two other men were charged with assault occasioning bodily harm and affray, Merseyside police said.

They are scheduled to world of warcraft gold appear in court on January 23.

In the wake of the charges, Liverpool issued a wow power leveling statement on their official Web site.

"Steven has been an outstanding servant to world of warcraft gold Liverpool for the last ten years and the club will give him all the support he needs at this time," it read.

The offenses with which Gerrard have been charged carry cheap wow gold a maximum penalty of five years in prison.

Three other men, who were also arrested, were world of warcraft gold released without charge pending further inquiries.

Gerrard was arrested cheap wow gold in the early hours of Monday morning and eventually charged after over 20 hours in police custody.

His wife Alex Curran was seen near the police station where world of warcraft gold he was held but drove off without talking to reporters.

Gerrard had been celebrating his side's 5-1 buy wow gold win over Newcastle on Sunday when the alleged altercation occurred.

He had scored two goals in the victory at St James' Park which left world of warcraft gold Liverpool top of the English Premier League and on course for their first English title in 18 years.

He was released on bail to wow power leveling appear in court on January 23 with John Doran, 29, and Ian Smith, 19, who were charged with the same offenses.

Gerrard, who has spent his entire career with Liverpool, world of warcraft gold is one of the most celebrated players in the club's history and renowned as a model professional.

In 2005 he lifted the European Cup -- Liverpool's fifth -- wow gold kaufen after a thrilling penalty shooting victory over AC Milan and turned down the advances of cash-rich Chelsea to stay with his local club.

The midfielder has also made 70 appearances for England, dofus kamas captaining his country on four occasions.

He was made an Member of the British Empire (MBE) last year and received an honorary fellowship from Liverpool's John Moores University.

Liverpool's next match is against Preston in the kamas dofusEnglish FA Cup on Saturday, a game Gerrard was due to sit out because of suspension

Anonymous said...

Do you know the warhammer gold, In here you can buy the warhammer Online gold, Do you know that the warhammer money in the game is very important, If you had more cheap warhammer Online gold . I think you can get the tall level, quickly come here to buy warhammer gold.

Welcome to the 2moons dil, In here you can buy the 2moons gold, Do you know that the 2moon dil in the game is very important, If you had more cheap 2moons gold. I think you can get the tall level, quickly come here to buy 2moons dil.

Anonymous said...

Now do you worried about that in the game do not had enough 2moons dil to play the game, now you can not worried, my friend told me a website, in here you can buy a lot 2moons gold and only spend a little money, do not hesitate, it was really, in here we had much 2moon dil, we can sure that you will get the cheap 2moons gold, quick to come here to buy 2moons dil.

Now do you worried about that in the game do not had enough 9Dragons gold to play the game, now you can not worried, my friend told me a website, in here you can buy a lot 9 Dragons gold and only spend a little money, do not hesitate, it was really, in here we had much 9Dragons money, we can sure that you will get the cheap 9Dragons gold, quick to come here to buy 9 Dragons gold.

Gold Guide for World of Warcraft said...

good post :)

Aion gold said...

I like play online game, I also buy Aion gold and Aion gold, the Aion china gold is very cheap, and use the Aion China kina can buy many things, I like Aion chinese gold, thanks, it is very good.

nike said...

http://www.polosales.com/ : cheap polo shirts
http://www.polosales.com/ : polo shirt
http://www.polosales.com/ : lacoste polo shirts
http://www.polosales.com/ : ralph lauren polo shirts
http://www.polosales.com/ : wholesale polo shirts
http://www.superpolos.com/mens-lacoste-solid-classicfit-polo-shirt-light-yellow-p-146/ : Yellow Polo Shirt
http://www.superpolos.com/wholesale-mens-short-sleeve-lacoste-polo-shirts-p-132/ : Men's Polo Shirts
http://www.superpolos.com/wholesale-mens-short-sleeve-lacoste-polo-shirts-p-133/ : Wholesale Polo Shirts
http://www.superpolos.com/ : polo shirts
http://www.superpolos.com/ : Lacoste polo shirts
http://www.pumachaussure.com/ : chaussure puma
http://www.pumachaussure.com/ : chaussures puma
http://www.polocart.com/ : polo shirts

bing said...

http://www.chihairstraightener.us/ : chi hair straightener
http://www.chiflatiron.us/ : chi flat iron

http://www.polool.com/ : new polo shirts


http://www.pursecart.com/ : cheap handbags
http://www.pursecart.com/ : cheap bags
http://www.pumachaussures.com/ : puma chaussures
http://www.pumachaussures.com/ : chaussures puma
http://www.pumachaussure.com/ : chaussure puma

http://www.jacketsworld.com/ : Men's North Face
http://www.jacketscart.com/ : Women's North Face


http://www.myhairstraighteners.co.uk/ : hair straighteners
http://www.sexylingeriestore.us/ : sexy lingerie store
http://www.uggsoutlet.us/ : cheap ugg boots
http://www.12hot.com/ : tattoo wholesale
http://www.polooo.net/ : men's clothing
http://www.acrazystore.com/ : women's clothing




http://www.thehairstraighteners.com/ : cheap hair straighteners
http://www.polosales.com/ : cheap Lacoste polo shirts
http://www.superpolos.com/ : cheap Lacoste polo shirts
http://www.shoesbuying.com/ : 2009 nike shoes
http://www.shoesbuying.com/2009-nike-shoes-c-153.htm : new nike shoes
http://www.shoesbuying.com/air-max-classic-bw-c-185.htm : Women's max
http://www.shoesbuying.com/mens-max-93-c-188.htm : Men's max 93
http://www.shoesbuying.com/nike-shox-c-165.htm : nike shox
http://www.shoesbuying.com/nike-force-c-174.htm : Nike air force
http://www.shoesbuying.com/nike-2003-c-181.htm : Nike air max 2003
http://www.shoesbuying.com/nike-air-max-ltd-c-166.htm : nike air max ltd
http://www.shoesbuying.com/nike-air-max-tn-c-167.htm : nike air max tn
http://www.shoesbuying.com/nike-rift-shoes-c-162.htm : Nike air rift
http://www.shoesbuying.com/nike-yeezy-c-184.htm : Nike air Yeezy
http://www.shoesbuying.com/nike-airmax-c-154.htm : nike airmax
http://www.shoesbuying.com/nike-airmax-c-155.htm : Nike air max 90
http://www.shoesbuying.com/nike-airmax-c-157.htm : Nike air max 97
http://www.shoesbuying.com/nike-birds-nest-shoes-c-152.htm : nike birds nest shoes
http://www.shoesbuying.com/nike-dunk-high-c-177.htm : nike dunk
http://www.shoesbuying.com/nike-shoes-c-168.htm : nike RT1 shoes
http://www.shoesbuying.com/nike-sb-c-180.htm : nike SB
http://www.shoesbuying.com/nike-shox-shoes-c-156.htm : nike shox shoes
http://www.shoesbuying.com/nike-shox-shoes-c-158.htm : Nike shox OZ shoes
http://www.shoesbuying.com/nike-shox-shoes-c-159.htm : Nike shox R2 shoes
http://www.shoesbuying.com/nike-shox-shoes-c-160.htm : Nike shox R3 shoes
http://www.shoesbuying.com/nike-shox-shoes-c-163.htm : Nike shox R4 shoes
http://www.shoesbuying.com/nike-shox-shoes-c-164.htm : Nike shox R5 shoes
http://www.shoesbuying.com/nike-shox-c-171.htm : Nike shox TL3
http://www.shoesbuying.com/nike-trainers-lovers-c-118.htm : nike trainers lovers

http://www.racketsoffer.com/ : tennis rackets
http://www.racketsoffer.com/wilson-racquets-c-19/ : Wilson tennis rackets
http://www.racketsoffer.com/head-racquets-c-18/ : HEAD tennis rackets
http://www.racketsoffer.com/babolat-racquets-c-17/ : Babolat tennis rackets

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

yiran said...

Your blog is wonderful, I like it very much, thank you!
By the way, do you like polo shirts, which are very chic, especially the polo t shirts, I love them very much. I also like playing tennis rackets, it can keep healthy, what do you like to do?
We are the outlet of polo t shirts women, polo t shirts on sale, polo t shirts for women, polo shirts on sale, these products are best-seller in our store online.besides we also sell polo shirts men, men's polo shirt, men polo shirt, mens polo shirts, mens polo shirt and cheap polo shirts, discount polo shirts, men's polo shirts, women's polo shirts We are also the outlet of cheap tennis racket, discount tennis racket and the main product is prince tennis racquet, head tennis rackets, wilson tennis racket, babolat tennis racquet. So if you love sports, you should not miss our store, we can meet what you want, and you can find many surprise in our store

mcmature said...

Thanks for such a great post and the review, I am totally impressed! Keep stuff like this coming.
big boobs

rootpp said...

funny jokes

rootpp said...

milf videos
Thanks for such a great post and the review, I am totally impressed! Keep stuff like this coming.

gurgaonindustry said...

Schools In Gurgaon | Hotels In Gurgaon | Hospitals in Gurgaon | Jewelers In Gurgaon


i like your blog

usb flash disk said...

Reliable and Professional China USB Flash Disk manufacturing

company, they have all types of USB Flash Disk, Logo USB,
Custom USB, as well as the newest and best USB Flash Disk,
plastic usb drive,
rubber usb drive,
metal usb drive,
leather usb drive,
metal usb drive,
fingerprint usb drive,
card usb drive,
swivel usb drive,
wooden usb drive,

Anonymous said...

which averages to about 7,353 watches per year.
http://www.watchestoo.com
replica watches
Men’s watches
Fake watches
ROLEX
rolex oyster perpetual datejust watch
rolex oyster perpetual datejust replica watch
rolex oyster perpetual datejust
rolex ladies datejust
rolex 116200
rolex 18k
rolex stainless
BREITLING
TAG HEUER
CARTIER
OMEGA
IWC
u boat
iw500112
IW376705

爱丽丝 said...

buy dstti
buy supercard dsonei
tiffany jewelry
supply best swarovski crystal
step up converter
E Cigarette
buy m3i zero
buy itouch DS
buy acekard 2i
wholesale blackberry phone
wholesale ed hardy jeans
keychain
laptop ac power adapter
manolo blahnik

artrepro said...

abstract oil paintings
impressionist oil paintings
landscape oil paintings
still life oil paintings
flowers oil paintings
religious oil paintings, etc.
buy oil paintings online

walkintub said...

That is some inspirational stuff. Never knew that opinions could be this varied. Thanks for all the enthusiasm to offer such

helpful information here.
I bookmarked it into my facebook and digg and share the good stuff with my friends too,Keep up work.Is there more aspect

about this subject walk in tub|
walk in tubs|
walk in baths|
walk in bathtubs
?I am looking forward to seeing it.

FTXT said...

How money much this it, 8023263 U.S.dollar.Thank you ,I don't konw you at city of ruzhou ,Lv Man ,miss u,forever. Two years, said in my all life ,miss you come on look out! 张少锋测试

longge said...

For those of you who own louis vuitton or would like to someday, just know that how you treat lv will affect the longevity of the bag. You can pass Louis vuitton bags down to the next generation if you take care of it. louis vuitton handbags were made to last for a lifetime. The quality of each bag speaks for itself. All I am saying is handle with care.

Roxy said...

Costa rica tours, shopping online, costa rica fishing, jaco fishing charters, costa rica whale watching, costa rica dolphin watching, costa rica party boat, panama fishing, fishing costa rica los suenos, los suenos fishing charters, costa rica fishing los suenos, los suenos costa rica fishing, costa rica los suenos fishing, fishing costa rica los suenos, los suenos fishing charters, costa rica fishing los suenos, los suenos costa rica fishing charters, costa rica los suenos fishing, Los suenos fishing, Fishing costa rica los suenos, Costa Rica Rafting,
http://www.kingtours.com/.

jack chan said...

lv cosmic blossom
cosmic blossom
louis vuitton cosmic blossom
lv store
lv purses
Soft Briefcase
batignolles horizontal louis vuitton
galliera lv
louis vuitton damier azur handbag
louis vuitton damier speedy 30
louis vuitton florin
louis vuitton damier neverfull mm
bulles
louis vuitton vavin
louis vuitton zippy wallet
louis vuitton laptop
laptop sleeve 13
louis vuitton boetie gm
louis vuitton epi leather
epi leather
louis vuitton anton
Sac Bosphore

manolo blahnik scarpe said...

thx for sharing ...xoxo

China heat pump industry analytics said...

I learned many tips in the website: heat pump China.

My friend, Jack, an IT company guy, bought 2 domestic heat pumps for his new house prepared for his wedding in October.

The building of InTime installed 10 units of commercial heat pumps last year. They bought these air water heat pumps from a famous manufacturer in China with an ideal price.

In recent years more and more pools began to install swimming pool heat pumps, which are considered as better alternative of electric heaters.

For beginners: air water heat pump ABC: What is a domestic heat pump? It's for residential use, generally including main untis and water tanks; What is a commercial heat pump? It's for commercial or industrial use; What is a swimming pool heat pump? It's for swimming.

longge said...

However, ugg boots which owns a array of acclaimed designers, not abandoned delights women by contemporary styles, but aswell by absolute abundance and practicality.Sheepskin ugg is absolutely crafted from wool. Many times, uggs are befuddled abroad because they get adulterated or channelled afterwards getting beat for one season, instead of acceptable out of date. There are lots of styles in the accumulating of affidavit ugg sundance , accoutrement tall, abbreviate and abate versions. Due to adaptable sheepskin, these ugg sundance boots do not get channelled or torn even admitting you bend and extend them times.

Evichen said...

These ugg australia are incredibly comfortable
as the sheepskin is providing excellent insulation against the cold but also absorbs excessive
moisture while letting your feet breath. To get the best fit in our ugg bailey button
it is best to measure your bare foot. To do this measure your ugg boots
from heel to longest toe.

Oil Paintings said...

Thanks Dear For This Great Post,It Such A Nice Blog Thanks For Sharing This Post With Us.

Digitizing said...

LY Digitizing has been in the business for over 10 years. They would like to offer you the best digitizing services and embroidery products with a very reasonable price. With advanced technology, equipment and embroidery digitizing software. They offer quick, efficient, competitive price and top quality embroidery dgitizing. LY Digitizing possess highly skilled professional art designers, digitizers, machine operators and computer professionals with innovative and creative abilities to give the best exquisite embroidery products for every customer.

Web Design Company said...

Your review is really good. I really impressed by this car.
Clone Script| Super Bowl 2012|

J4858C said...

OurFiber.com is the website of Mingon Technology Co, Ltd. and we are the professional fiber transceiver manufacture which product the SFP transceiver like j4858c,agm731f,3CSFP91,MGBSX1,DEM 311GT, AT SPSX, j4859C are 1000base transceiver. And SFP plus like SFP 10G SR, SFP 10G LR, X2 10GB SR, X2 10GB LR, XENPAK 10GB SR and etc, our products are hot sale items and have excellent quality which have already passed the CE, ROHS and other certifications after we did a series of improvements!

Bily said...

Oil Paintings
Picasso Painting
Landscape Painting
Abstract Painting

Paul Simmon said...

It’s actually a cool and useful piece of information. I am happy that you just shared this helpful info with us. Please keep us up to date like this. Thank you for sharing.

ice maker said...


I know this if off topic but I'm looking into starting my own weblog and was large ice machine curious what all is required to get set up? I'm assuming having a blog like yours would cost a pretty penny? I'm not very internet smart so I'm not 100% positive.

fgdg said...

The past is gone and static. Nothing we can do will change it.scarlet blade gold, the future is before us and dynamic. Everything we do will affect it rs gold, You laugh at mescarlet blade gold for being different , but I laugh at you for being the same.

fgdg said...

You laugh at me for being different, but I laugh at you for being the same LOTRO Gold, the consequences of today are determined by the actions of the past Lord Of The Rings Gold, to change your future,LOTRO Gold alter your decisions today.