使用Ajax.BeginForm下载文件

时间:2016-09-18 16:23:24

标签: ajax asp.net-mvc

我通过 /** * Returns this host's non-loopback IPv4 addresses. * * @return * @throws SocketException */ private static List<Inet4Address> getInet4Addresses() throws SocketException { List<Inet4Address> ret = new ArrayList<Inet4Address>(); Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netint : Collections.list(nets)) { Enumeration<InetAddress> inetAddresses = netint.getInetAddresses(); for (InetAddress inetAddress : Collections.list(inetAddresses)) { if (inetAddress instanceof Inet4Address && !inetAddress.isLoopbackAddress()) { ret.add((Inet4Address)inetAddress); } } } return ret; } /** * Returns this host's first non-loopback IPv4 address string in textual * representation. * * @return * @throws SocketException */ private static String getHost4Address() throws SocketException { List<Inet4Address> inet4 = getInet4Addresses(); return !inet4.isEmpty() ? inet4.get(0).getHostAddress() : null; } 下载文件时出现问题。 我知道,这不是一个好主意但我确实需要使用它下载

我有 Ajax.BeginForm ,正在生成文件,我需要下载它。

有一个例子,我是如何尝试的:

Controller

如何使用Ajax下载它? 谢谢!

0 个答案:

没有答案