当前位置: 动力学知识库 > 问答 > 编程问答 >

asp.net - How to send raw html with JS-data in WebAPI2

问题描述:

I know that in ASP.NET MVC we can send raw HTML-page by using Html.Raw().

Now I have an WebAPI2 application with HttpGet method : user sends some values X and Y :

public string\ActionResult DrawMap(double x, double y)

Also in project I have some HTML page where some JS draw map with this x and y.

I want this method take this HTML file, draw map, prepare updated HTML file and return it as a seqeunce of string.

Should I use Html.Raw(), what means I need to use MVC library. Or there are another more appropriate and more correct approaches to implement it?

Then this string will be displayed by Swift\Android, something like this sample:

var attrStr = NSAttributedString(

data: "MY_HTML".dataUsingEncoding(NSUnicodeStringEncoding, allowLossyConversion: true),

options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],

documentAttributes: nil,

error: nil)

label.attributedText = attrStr

分享给朋友:
您可能感兴趣的文章:
随机阅读: