Tag: asp.net mvc

什么请求头用于上传图像文件从iOS到ASP.NET?

我正在构build一个iOS应用程序,我想将图像上传到ASP.NET MVC服务器组件,比如在网页中发布文件。 我在iOS中创build了NSMutableURLRequest和NSConnection对象,并validation了.NET服务器组件正在工作。 NSMutableURLRequest *request=[[NSMutableURLRequest alloc]init]; [request setTimeoutInterval:(interval==0?SERVICE_DEFAULT_TIMEOUT_INTERVAL:interval)]; [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",SERVICE_BASEURL,url]]]; [request setHTTPMethod:@"POST"]; … 图像数据位于AVFoundation模块的NSData对象中 NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer]; 在服务器上.NET组件中的控制器方法是 [HttpPost] public JsonResult UploadMedia(HttpPostedFileBase fileData) { … return Json(@"Success"); } 目标是将图像数据传输到服务器并进行存储。 我的问题是: 还有哪些HttpHeaderField值需要创build? 我应该如何在NSMutableURLRequest中embedded图像数据? .NET组件方法中应该是什么types的参数? 根据#3中的types,我应该如何提取服务器组件中的图像数据?

阿拉伯数据显示????? 从asp.net mvc到使用networking库的ios应用程序的字符

阿拉伯数据显示????? 从asp.net mvc到iOS应用程序使用networking库来处理响应对象的字符。 #import "AppGateway.h" //the web location of the service #define kAPIHost @"domain" #define kAPIPath @"Home/GetNews/" @implementation AppGateway /*Singleton*/ +(AppGateway*)sharedInstance { static AppGateway *sharedInstance = nil; static dispatch_once_t oncePredicate; dispatch_once(&oncePredicate, ^{ sharedInstance = [[self alloc] initWithBaseURL:[NSURL URLWithString:kAPIHost]]; }); return sharedInstance; } -(AppGateway*)init{ self = [super init]; if(self!=nil) { [self registerHTTPOperationClass:[AFJSONRequestOperation class]]; [self setDefaultHeader:@"Accept" value:@"application/json"]; […]

.net MVCstreamMP4到iDevice问题

对于我一直在为video服务的一段代码,我遇到了一些问题。 代码如下: public ResumingFileStreamResult GetMP4Video(string videoID) { if (User.Identity.IsAuthenticated) { string clipLocation = string.Format("{0}\\Completed\\{1}.mp4", ConfigurationManager.AppSettings["VideoLocation"].ToString(), videoID); FileStream fs = new FileStream(clipLocation, FileMode.Open, FileAccess.Read); ResumingFileStreamResult fsr = new ResumingFileStreamResult(fs, "video/mp4"); return fsr; } else { return null; } } 这是我的HTML代码: <video controls preload poster="@Url.Content(string.Format("~/Videos/{0}_2.jpg", Model.VideoID))"> <source src="@Url.Action("GetMP4Video", "Video", new { videoID = Model.VideoID })" type="video/mp4" /> […]

Google方向图无法在iPad上加载风景方向

我在加载地图在iPad的景观(在肖像一切工作正常)有问题。 编辑:我发现一个问题,相关的事实,因为缺乏空间,当我减less高度地图元素是“推”下方向元素aparently后。 我试图得到元素的stream体,但它仍然推下去。 景观(问题): 当我将iPad旋转到肖像(OK)时: 代码: 脚本: var _directionsService = new google.maps.DirectionsService(); var _directionsDisplay = new google.maps.DirectionsRenderer(); var _map = new google.maps.Map(document.getElementById('dtl-directions-map-canvas')); _directionsDisplay.setMap(_map); _directionsDisplay.setPanel(document.getElementById('dtl-directions-panel')); var start = new google.maps.LatLng(_locationLatitude, _locationLongitude); var end = new google.maps.LatLng(_partnerLatitude, _partnerLongitude); var request = { origin: start, destination: end, travelMode: google.maps.TravelMode.DRIVING, provideRouteAlternatives: true }; _directionsService.route(request, function (response, status) { if […]

在iOS Safari浏览器会话之间不保存Cookie

我有一个MVC 4网站,用户可以login,我用他们的会话信息保存一个cookie,所以他们不必再次login。 public void SetCookie(HttpCookie cookie) { HttpContext.Current.Response.Cookies.Set(cookie); } 这在桌面设备上工作,但是当我在iOS上运行这个,它不能100%的时间工作。 如果我在移动浏览器(Chrome或Safari)中至less保留1个页面,并导航回我的网站,我的会话cookie被find,我不必login。 但是,如果我closures该浏览器的所有窗口,那么下一次导航回我的网站时,会话cookie不会被发现。 我在我的Cookie上设置了1年的期限/到期时间,因此不会过期。 到目前为止我发现的唯一的事情是,这是.NET 4.0中的一个错误,在.NET 4.5中已经修复。 我相信我已经在运行.NET 4.5,通过查看我的* .csproj和TargetFrameworkVersion元素: <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion> </ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{xxxxxxxxxxxxxxxxxx}</ProjectGuid> <ProjectTypeGuids>{xxxxxxxx};{xxxxxxxxxxxxx};{xxxxxxxxxxxxxxxx}</ProjectTypeGuids> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MyApp</RootNamespace> <AssemblyName>MyApp</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <MvcBuildViews>false</MvcBuildViews> <UseIISExpress>true</UseIISExpress> <IISExpressSSLPort /> <IISExpressAnonymousAuthentication […]