Use User-Agent C# for divices Android and iOS -
i have 2 buttons 1 download .apk , download .ipa, in homecontroller have:
[httpget] public fileresult downloadios() { var filename = ("app.ipa"); var filepath = $"apps/{filename}"; byte[] filebytes = system.io.file.readallbytes(filepath); return file(filebytes, "application/ipa", filename); } [httpget] public fileresult downloadandroid() { var filename = ("app.apk"); var filepath = $"apps/{filename}"; byte[] filebytes = system.io.file.readallbytes(filepath); return file(filebytes, "application/apk", filename); }
what want can not download android device ios app , vice versa. use user-agent example:
if (useragent.contains("android")) { clientosname = getosversion(useragent, "android"); .... } else (useragent.contains("iphone")) { clientosname = getosversion(useragent, "iphone"); ... }
Comments
Post a Comment