ASP.NET use

Nov 7, 2012 at 8:56 AM

Hi. I have tried to use the library on a ASP.NET MVC project. Unfortunately, all functions seems to hang. On a standard app, it works fine. Is this a known limitation of the library or is there something I can do to have it work in my project? It's an old project started in VS2010 and MVC3 upgraded to VS2012. So before investigating further, I wanted to be sure if the use of the library in an ASP.NET MVC project is supposed to work. Thanks in advance for your help.

Nov 12, 2012 at 4:52 PM

Just to confirm, I have also tried the new SmugMugModel 3.0 beta in an MVC4 project and it hangs while trying to authenticate.

The below calls hangs up:

accessTok =SmugMugAuthorize.AuthorizeSmugMug(mySite);

A Fiddler trace shows a call to secure.smugmug.com POST /services/api/json/1.3.0/ HTTP/1.1  that does not return

 

 

Developer
Nov 12, 2012 at 5:23 PM

Hi

I am going to take a look at this soon.

For web apps, there are some gotchas with using Async. Can you try using the non-async version of the methods and see if that works?

Thanks,

Alex

Nov 13, 2012 at 12:35 PM

Hi. I've tried both sync and async methods. Sync just hangs as explained above. Async generates an exception. Don't remember exactly which one. Can try again when I'm back home.

Developer
Nov 13, 2012 at 2:35 PM

Thanks for this info!

Could you also tell me what the exception is?

When an exception happens inside an async call (and even the sync version uses the async version under the covers) the exception should be bubbled up by the async infrastructure and not hang.

Async in a web page is a bit different than using it in a console app because of how requests are processed in the web world.

This article might be of some help: http://msdn.microsoft.com/en-us/library/system.web.ui.page.registerasynctask.aspx

Please also send me the exception and I will investigate! :)

Alex

Nov 13, 2012 at 8:23 PM
Edited Nov 13, 2012 at 8:56 PM

Sorry, was an error in my code the exception. I now get the timeout with both sync and async calls. Regarding the link you provided above, it's related to WebForms. MVC framework doesn't use WebForms anymore and should support async operations. I will do some tests and let you know.

I tried tonight to use an AsyncController to do library calls. But same results.

Developer
Nov 13, 2012 at 9:25 PM

Thanks for letting me know!

Do you have a small project that you can share?

Alex

Nov 15, 2012 at 9:10 AM
Edited Nov 15, 2012 at 9:11 AM

Hi. I prepared a small project. It's just a simple ASP.Net MVC4 project that should be opened using VS2012. It does nothing except try to login to SmugMug (using sync version). In the source, you'll have to introduce your api and secret keys (well in practice it's not necessary as it hangs) and fix references I suppose. Project can be download here. Hope it'll help you find a solution.

Jacques

Developer
May 27, 2013 at 7:23 AM
Hey Jacques

I did not get a chance to look into this (d'uh) -- were you able to figure it out?

Thanks,
Alex