0

how can i detect if wcf call is requested by iOS or Android?

I have the following WCF method.

public Stream GetSmartLinkImage(string SmartLinkId)
{
        wmas_subsDataContext dc = new wmas_subsDataContext();
        string path = string.Empty;

        var fileRecord = from p in dc.Images where p.ImageTitle == "IMG0001" select p;

        if (fileRecord.Count() > 0)
        {
            path = ConfigurationManager.AppSettings["ImagesPath"].ToString() + "\\" + fileRecord.First().ImageName;
        }

        FileStream fs = File.OpenRead(path);

        return fs;
}
Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Hammad Bukhari
  • 73
  • 3
  • 14
  • You can add something like "DeviceType" property inside SmartLinkId type and set that property on client side. – JakubJ May 14 '15 at 11:32
  • I need a way which should work automatically without sending a parameter . I need to know if there is way to detect it if calling phone is ios or android in my wcf method. – Hammad Bukhari May 14 '15 at 12:15
  • I am afraid that is not possible. According to these questions: http://stackoverflow.com/questions/7286804/identifying-clients-in-a-wcf-service and http://stackoverflow.com/questions/3277256/identifying-wcf-client-id , you have to either pass the information as a parameter or include it in custom header. Without it, you wont be able to identify the client device. – JakubJ May 14 '15 at 12:22
  • Maybe if i get IIS header in my WCF method ?then i might be able to know the device type. can i? – Hammad Bukhari May 14 '15 at 12:47

0 Answers0