Value cannot be null.

Topics: User Forum
Oct 17, 2006 at 5:17 AM
Hi,

Thanks for a great library. It makes Flickr easy. My website works fine locally but when I publish to my ISP I get the following error message. Any ideas?

Thanks in advance.

Server Error in '/' Application.
--------------------------------------------------------------------------------

Value cannot be null.
Parameter name: path1
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: path1

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ArgumentNullException: Value cannot be null.
Parameter name: path1]
System.IO.Path.Combine(String path1, String path2) +2718123
FlickrNet.Cache.get_Responses() +76
FlickrNet.Flickr.GetResponse(Hashtable parameters, TimeSpan cacheTimeout) +663
FlickrNet.Flickr.GetResponseCache(Hashtable parameters) +42
FlickrNet.Flickr.PhotosSearch(PhotoSearchOptions options) +1108
_Default.yaya(Flickr flickr, PhotoSearchOptions searchOptions, Boolean UseRandom) +18
Default.PageLoad(Object sender, EventArgs e) +205
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Oct 26, 2006 at 5:23 PM
I am running into this issue too. Can someone please provide some tips to resolve this issue?

Thanks.
Coordinator
Oct 30, 2006 at 8:59 AM
It looks like an issue with Caching. You could temporaryily disable caching, or find the cache location and delete the cache directory to start again. I'll check out the error and report back.
Oct 31, 2006 at 2:38 AM
What Cache are you referring to? The IE cache or a different cache?
Coordinator
Oct 31, 2006 at 8:10 AM
The FlickrNet caching. See the Examples page for how to disable the cache either via the web.config/app.config or in code (using the Flickr.CacheDisabled property)
Oct 31, 2006 at 8:40 AM
So, Now I am running into this error: "Unable to connect to remote server (9999)"

I am trying to use FlickRNet in ASP.Net. I have a simple page with a single label control. In the Page Load function, I have the following code:

Flickr flickr = new Flickr(apikey);

PhotoSearchOptions searchOptions = new PhotoSearchOptions();
searchOptions.Tags = "microsoft";
searchOptions.PerPage = 10;
Photos microsoftPhotos = flickr.PhotosSearch(searchOptions);

lbl1.Text = microsoftPhotos.TotalPhotos.ToString();

When I upload the page to the server and navigate to the page I get the error:

Unable to connect to the remote server (9999)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: FlickrNet.FlickrException: Unable to connect to the remote server (9999)

Source Error:


Line 22: searchOptions.Tags = "microsoft";
Line 23: searchOptions.PerPage = 10;
Line 24: Photos microsoftPhotos = flickr.PhotosSearch(searchOptions);
Line 25:
Line 26: lbl1.Text = microsoftPhotos.TotalPhotos.ToString();

Source File: e:\kunden\homepages\1\d173303665\communies\FlickR\FlickR2.aspx Line: 24

Stack Trace:

FlickrException: Unable to connect to the remote server (9999)
FlickrNet.Flickr.DoGetResponse(String url) +346
FlickrNet.Flickr.GetResponse(Hashtable parameters, TimeSpan cacheTimeout) +631
FlickrNet.Flickr.GetResponseCache(Hashtable parameters) +42
FlickrNet.Flickr.PhotosSearch(PhotoSearchOptions options) +1108
ASP.flickrflickr2aspx.Page_Load(Object sender, EventArgs e) in e:\kunden\homepages\1\d173303665\communies\FlickR\FlickR2.aspx:24
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

Maybe this issue is not related to this thread?
Coordinator
Oct 31, 2006 at 1:58 PM
Looks like a simple network error. Do you have a proxy server configured?

(ignore the next bit, just testing linking to the Wiki)
ExampleConfigFile
Oct 31, 2006 at 3:20 PM
I don't have a proxy server configured (at least, I don't think so). I don't have anything in the Web.config file that references FlickrNet.

Nov 2, 2006 at 3:54 AM
Any further comment on this?
Coordinator
Nov 3, 2006 at 8:09 AM
The value cannot be null error is coming from the cache location being unwritable I think - manually configure it in the configuration file or set it in code (Flickr.CacheLocation).

As for the network error - might it be that the web hosting you are using doesn't allow outgoing connections? Can you make a simple HttpRequest to ANY web site? DOes the following work?

  HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://www.flickr.com");
  req.GetResponse();

If you get the same error from that then its a network/hosting issue and nothing to do with the code.

Sam
Nov 7, 2006 at 12:04 AM
Thanks for the code sample, Sam. I still get the socket error when I used your code. So, I guess this means the issue is with my hosting options. How can I get around this issue?
Nov 7, 2006 at 12:05 AM
Here is the error:

Server Error in '/communies' Application.
--------------------------------------------------------------------------------

A socket operation was attempted to an unreachable network
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network

Source Error:


Line 28:
Line 29: HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://www.flickr.com");
Line 30: req.GetResponse();
Line 31:
Line 32:
Coordinator
Nov 7, 2006 at 9:07 AM
You will have to contact the support team of your web hosting and ask them.
Nov 14, 2006 at 8:55 PM
You were right. My hosting company does not support this :(

Are there suggestions of reliable and economical hosting solutions where I can get FlickrNet to work?
Aug 30, 2007 at 5:59 AM
Greetings to all!

I know this is a very old issue, but I just can't make it work for me! I downloaded Flickr.net 2.1.5 and created a very simple website to browse only public photos (no authentication involved). Below is the code:

FlickrNet.Flickr flickr = new FlickrNet.Flickr();
FlickrNet.PhotoSearchOptions options = new FlickrNet.PhotoSearchOptions();
options.Tags = "Sydney Australia";
options.PerPage = 40;
options.Page = 1;
options.SortOrder = FlickrNet.PhotoSearchSortOrder.DatePostedDesc;
FlickrNet.Photos photos = flickr.PhotosSearch(options);

It works fine locally but not with my web hosting account (1and1.com). I get the "A socket operation was attempted to an unreachable network" error from flickr.PhotosSearch(options). It looks like a web hosting problem, right? But I CAN make HttpWebRequest to Flickr,com and other websites and I also can access Amazon and Youtube web services within the same hosting account. Could anyone tell me what is wrong?


Jan 3, 2011 at 7:29 PM

Hi, I´ve similar problem to richnet.

I created a web page to list photos by a PhotosetID (no authentication involved).
I have the following code:

 

        FlickrNet.Flickr flickr = new FlickrNet.Flickr();
        FlickrNet.Photo[] arrayPhotos = Flickr.PhotosetsGetPhotos(sPhotoSetID);

        PhotoRepeater.DataSource = arrayPhotos;
        PhotoRepeater.DataBind();

 

It works fine locally... and I can make a simple HttpRequest to "flickr.com" as samjudson ask remotely, but when I run the code above (remotely) I got this error (bellow you may find the stack trace).

Any ideas?

 

Unable to connect to the remote server (9999)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: FlickrNet.FlickrException: Unable to connect to the remote server (9999)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[FlickrException: Unable to connect to the remote server (9999)]
   FlickrNet.Flickr.DoGetResponse(String url) +360
   FlickrNet.Flickr.GetResponse(Hashtable parameters, TimeSpan cacheTimeout) +653
   FlickrNet.Flickr.PhotosetsGetPhotos(String photosetId, PhotoSearchExtras extras, PrivacyFilter privacyFilter) +193
   FlickrNet.Flickr.PhotosetsGetPhotos(String photosetId) +12
   PhotoAlbumCs.Photosset(String sSetID) +36
   PhotoAlbumCs.Page_Load(Object sender, EventArgs e) +324
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Coordinator
Jan 4, 2011 at 7:18 AM

If it works on your machine but not when you upload it to your server then I'm afraid it definitely looks like a network or blocking issue.

Try changing your simple HttpRequest to call "api.flickr.com" and see if that gets the same error.

Sam

Jan 14, 2011 at 6:47 PM

Hi, Sam! 

As you suggested I´ve created another page requesting "api.flickr.com", and I get the result successfully.
But, when I try to use FlickrAPI I still get the same error.. :(

Bellow you may find the urls that I´ve published:
http://www.webit.com.br/RequestCs.aspx?uri=http://api.flickr.com (simple HttpRequest)
http://www.webit.com.br/PhotoAlbumCs.aspx?PhotosetID=72157618979029872 (my Flickr List)

 

Any other ideas?

Thanks in advance

Coordinator
Jan 14, 2011 at 9:12 PM

The page I see when I click on your first link above is the Flickr home page. However if I go directly to http://api.flickr.com/ then I see a completely different page, so something isn't right somewhere.

Jan 19, 2011 at 11:28 AM

Sorry, Sam. Please try it again...

http://www.webit.com.br/RequestCs.aspx?uri=http://api.flickr.com

But I get 404 requesting the address http://api.flickr.com/ (remotely and locally)

 

Coordinator
Jan 20, 2011 at 8:26 AM

Well in that case I can only assume that Flickr is blocking that IP address for some reason.

This can happen quite a bit on shared hosting solutions (Dreamhost is a frequent hosting provider mentioned) where someone on the same box (or even historically on the same box) has got that IP address blocked.

You have three choices - move to a different hosting provider, try to get your hosting provider to move you to a different box (and hence IP address) or contact Flickr and see if they will unblock the IP address.

Hope that is of some help?

Sam

Jan 20, 2011 at 1:23 PM

Thanks, Sam.

I´ve published it in another hosting and works:
http://gegroup.dominiotemporario.com/PhotoAlbumCs.aspx?PhotosetID=72157624991457295

But, I´ll contact Flickr in order to understand why the other IP is blocked.

Cheers!