├── ApiWeb ├── ApiWeb.csproj ├── ApiWeb.csproj.user ├── App_Start │ └── WebApiConfig.cs ├── Areas │ └── HelpPage │ │ ├── ApiDescriptionExtensions.cs │ │ ├── App_Start │ │ └── HelpPageConfig.cs │ │ ├── Controllers │ │ └── HelpController.cs │ │ ├── HelpPage.css │ │ ├── HelpPageAreaRegistration.cs │ │ ├── HelpPageConfigurationExtensions.cs │ │ ├── Models │ │ └── HelpPageApiModel.cs │ │ ├── SampleGeneration │ │ ├── HelpPageSampleGenerator.cs │ │ ├── HelpPageSampleKey.cs │ │ ├── ImageSample.cs │ │ ├── InvalidSample.cs │ │ ├── ObjectGenerator.cs │ │ ├── SampleDirection.cs │ │ └── TextSample.cs │ │ ├── Views │ │ ├── Help │ │ │ ├── Api.cshtml │ │ │ ├── DisplayTemplates │ │ │ │ ├── ApiGroup.cshtml │ │ │ │ ├── HelpPageApiModel.cshtml │ │ │ │ ├── ImageSample.cshtml │ │ │ │ ├── InvalidSample.cshtml │ │ │ │ ├── Parameters.cshtml │ │ │ │ ├── Samples.cshtml │ │ │ │ └── TextSample.cshtml │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ │ └── XmlDocumentationProvider.cs ├── Controllers │ ├── BaseController.cs │ └── TestApiController.cs ├── Global.asax ├── Global.asax.cs ├── Models │ ├── AsciiComparer.cs │ ├── ResultModel.cs │ └── SignHelper.cs ├── Project_Readme.html ├── Properties │ └── AssemblyInfo.cs ├── Views │ ├── Web.config │ └── _ViewStart.cshtml ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── favicon.ico ├── obj │ └── Debug │ │ ├── ApiWeb.csproj.FileListAbsolute.txt │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs └── packages.config ├── BusinessWeb ├── App_Start │ └── RouteConfig.cs ├── BusinessWeb.csproj ├── BusinessWeb.csproj.user ├── Controllers │ └── BusinessController.cs ├── Global.asax ├── Global.asax.cs ├── Models │ ├── AsciiComparer.cs │ ├── ResultModel.cs │ └── SignHelper.cs ├── Properties │ └── AssemblyInfo.cs ├── Views │ └── web.config ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── bin │ ├── Newtonsoft.Json.dll │ ├── System.Web.Helpers.dll │ ├── System.Web.Mvc.dll │ ├── System.Web.Razor.dll │ ├── System.Web.Webpages.Deployment.dll │ ├── System.Web.Webpages.Razor.dll │ └── System.Web.Webpages.dll ├── obj │ └── Debug │ │ ├── BusinessWeb.csproj.FileListAbsolute.txt │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs └── packages.config ├── WebDemo.sln └── packages ├── Antlr.3.4.1.9004 ├── Antlr.3.4.1.9004.nupkg └── lib │ ├── Antlr3.Runtime.dll │ └── Antlr3.Runtime.pdb ├── Microsoft.AspNet.Mvc.5.0.0 ├── Microsoft.AspNet.Mvc.5.0.0.nupkg └── lib │ └── net45 │ ├── System.Web.Mvc.dll │ ├── System.Web.Mvc.xml │ └── zh-Hans │ ├── System.Web.Mvc.resources.dll │ └── System.Web.Mvc.xml ├── Microsoft.AspNet.Mvc.zh-Hans.5.0.0 ├── Microsoft.AspNet.Mvc.zh-Hans.5.0.0.nupkg └── lib │ └── net45 │ └── zh-Hans │ ├── System.Web.Mvc.resources.dll │ └── System.Web.Mvc.xml ├── Microsoft.AspNet.Razor.3.0.0 ├── Microsoft.AspNet.Razor.3.0.0.nupkg └── lib │ └── net45 │ ├── System.Web.Razor.dll │ ├── System.Web.Razor.xml │ └── zh-Hans │ ├── System.Web.Razor.resources.dll │ └── system.web.razor.xml ├── Microsoft.AspNet.Razor.zh-Hans.3.0.0 ├── Microsoft.AspNet.Razor.zh-Hans.3.0.0.nupkg └── lib │ └── net45 │ └── zh-Hans │ ├── System.Web.Razor.resources.dll │ └── system.web.razor.xml ├── Microsoft.AspNet.Web.Optimization.1.1.1 ├── Microsoft.AspNet.Web.Optimization.1.1.1.nupkg └── lib │ └── net40 │ ├── System.Web.Optimization.dll │ ├── system.web.optimization.xml │ └── zh-Hans │ └── System.Web.Optimization.resources.dll ├── Microsoft.AspNet.Web.Optimization.zh-Hans.1.1.1 ├── Microsoft.AspNet.Web.Optimization.zh-Hans.1.1.1.nupkg └── lib │ └── net40 │ └── zh-Hans │ └── System.Web.Optimization.resources.dll ├── Microsoft.AspNet.WebApi.5.0.0 └── Microsoft.AspNet.WebApi.5.0.0.nupkg ├── Microsoft.AspNet.WebApi.Client.5.0.0 ├── Microsoft.AspNet.WebApi.Client.5.0.0.nupkg └── lib │ ├── net45 │ ├── System.Net.Http.Formatting.dll │ ├── System.Net.Http.Formatting.xml │ └── zh-Hans │ │ ├── System.Net.Http.Formatting.resources.dll │ │ └── System.Net.Http.Formatting.xml │ └── portable-wp8%2Bnetcore45%2Bnet45 │ ├── System.Net.Http.Formatting.dll │ └── System.Net.Http.Formatting.xml ├── Microsoft.AspNet.WebApi.Client.zh-Hans.5.0.0 ├── Microsoft.AspNet.WebApi.Client.zh-Hans.5.0.0.nupkg └── lib │ └── net45 │ └── zh-Hans │ ├── System.Net.Http.Formatting.resources.dll │ └── System.Net.Http.Formatting.xml ├── Microsoft.AspNet.WebApi.Core.5.0.0 ├── Microsoft.AspNet.WebApi.Core.5.0.0.nupkg ├── content │ └── web.config.transform └── lib │ └── net45 │ ├── System.Web.Http.dll │ ├── System.Web.Http.xml │ └── zh-Hans │ ├── System.Web.Http.resources.dll │ └── System.Web.Http.xml ├── Microsoft.AspNet.WebApi.Core.zh-Hans.5.0.0 ├── Microsoft.AspNet.WebApi.Core.zh-Hans.5.0.0.nupkg └── lib │ └── net45 │ └── zh-Hans │ ├── System.Web.Http.resources.dll │ └── System.Web.Http.xml ├── Microsoft.AspNet.WebApi.HelpPage.5.0.0 ├── Microsoft.AspNet.WebApi.HelpPage.5.0.0.nupkg └── content │ └── Areas │ └── HelpPage │ ├── ApiDescriptionExtensions.cs.pp │ ├── App_Start │ └── HelpPageConfig.cs.pp │ ├── Controllers │ └── HelpController.cs.pp │ ├── HelpPage.css.pp │ ├── HelpPageAreaRegistration.cs.pp │ ├── HelpPageConfigurationExtensions.cs.pp │ ├── Models │ └── HelpPageApiModel.cs.pp │ ├── SampleGeneration │ ├── HelpPageSampleGenerator.cs.pp │ ├── HelpPageSampleKey.cs.pp │ ├── ImageSample.cs.pp │ ├── InvalidSample.cs.pp │ ├── ObjectGenerator.cs.pp │ ├── SampleDirection.cs.pp │ └── TextSample.cs.pp │ ├── Views │ ├── Help │ │ ├── Api.cshtml.pp │ │ ├── DisplayTemplates │ │ │ ├── ApiGroup.cshtml.pp │ │ │ ├── HelpPageApiModel.cshtml.pp │ │ │ ├── ImageSample.cshtml.pp │ │ │ ├── InvalidSample.cshtml.pp │ │ │ ├── Parameters.cshtml.pp │ │ │ ├── Samples.cshtml.pp │ │ │ └── TextSample.cshtml.pp │ │ └── Index.cshtml.pp │ ├── Shared │ │ └── _Layout.cshtml.pp │ ├── Web.config │ └── _ViewStart.cshtml.pp │ └── XmlDocumentationProvider.cs.pp ├── Microsoft.AspNet.WebApi.WebHost.5.0.0 ├── Microsoft.AspNet.WebApi.WebHost.5.0.0.nupkg └── lib │ └── net45 │ ├── System.Web.Http.WebHost.dll │ ├── System.Web.Http.WebHost.xml │ └── zh-Hans │ ├── System.Web.Http.WebHost.resources.dll │ └── System.Web.Http.WebHost.xml ├── Microsoft.AspNet.WebApi.WebHost.zh-Hans.5.0.0 ├── Microsoft.AspNet.WebApi.WebHost.zh-Hans.5.0.0.nupkg └── lib │ └── net45 │ └── zh-Hans │ ├── System.Web.Http.WebHost.resources.dll │ └── System.Web.Http.WebHost.xml ├── Microsoft.AspNet.WebPages.3.0.0 ├── Microsoft.AspNet.WebPages.3.0.0.nupkg └── lib │ └── net45 │ ├── System.Web.Helpers.dll │ ├── System.Web.Helpers.xml │ ├── System.Web.WebPages.Deployment.dll │ ├── System.Web.WebPages.Deployment.xml │ ├── System.Web.WebPages.Razor.dll │ ├── System.Web.WebPages.Razor.xml │ ├── System.Web.WebPages.dll │ ├── System.Web.WebPages.xml │ └── zh-Hans │ ├── System.Web.Helpers.resources.dll │ ├── System.Web.WebPages.Deployment.resources.dll │ ├── System.Web.WebPages.Razor.resources.dll │ ├── System.Web.WebPages.resources.dll │ ├── system.web.helpers.xml │ ├── system.web.webpages.deployment.xml │ ├── system.web.webpages.razor.xml │ └── system.web.webpages.xml ├── Microsoft.AspNet.WebPages.zh-Hans.3.0.0 ├── Microsoft.AspNet.WebPages.zh-Hans.3.0.0.nupkg └── lib │ └── net45 │ └── zh-Hans │ ├── System.Web.Helpers.resources.dll │ ├── System.Web.WebPages.Deployment.resources.dll │ ├── System.Web.WebPages.Razor.resources.dll │ ├── System.Web.WebPages.resources.dll │ ├── system.web.helpers.xml │ ├── system.web.webpages.deployment.xml │ ├── system.web.webpages.razor.xml │ └── system.web.webpages.xml ├── Microsoft.Web.Infrastructure.1.0.0.0 ├── Microsoft.Web.Infrastructure.1.0.0.0.nupkg ├── Microsoft.Web.Infrastructure.1.0.0.0.nuspec └── lib │ └── net40 │ └── Microsoft.Web.Infrastructure.dll ├── Modernizr.2.6.2 ├── Content │ └── Scripts │ │ └── modernizr-2.6.2.js ├── Modernizr.2.6.2.nupkg └── Tools │ ├── common.ps1 │ ├── install.ps1 │ └── uninstall.ps1 ├── Newtonsoft.Json.5.0.6 ├── Newtonsoft.Json.5.0.6.nupkg └── lib │ ├── net20 │ ├── Newtonsoft.Json.dll │ └── Newtonsoft.Json.xml │ ├── net35 │ ├── Newtonsoft.Json.dll │ └── Newtonsoft.Json.xml │ ├── net40 │ ├── Newtonsoft.Json.dll │ └── Newtonsoft.Json.xml │ ├── net45 │ ├── Newtonsoft.Json.dll │ └── Newtonsoft.Json.xml │ ├── netcore45 │ ├── Newtonsoft.Json.dll │ └── Newtonsoft.Json.xml │ ├── portable-net40%2Bsl4%2Bwp7%2Bwin8 │ ├── Newtonsoft.Json.dll │ └── Newtonsoft.Json.xml │ └── portable-net45%2Bwp80%2Bwin8 │ ├── Newtonsoft.Json.dll │ └── Newtonsoft.Json.xml ├── Respond.1.2.0 ├── Respond.1.2.0.nupkg └── content │ └── Scripts │ ├── respond.js │ └── respond.min.js ├── WebGrease.1.5.2 ├── WebGrease.1.5.2.nupkg ├── lib │ └── WebGrease.dll └── tools │ └── WG.exe ├── bootstrap.3.0.0 ├── bootstrap.3.0.0.nupkg └── content │ ├── Content │ ├── bootstrap.css │ └── bootstrap.min.css │ ├── Scripts │ ├── bootstrap.js │ └── bootstrap.min.js │ └── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── jQuery.1.10.2 ├── Content │ └── Scripts │ │ ├── jquery-1.10.2-vsdoc.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ └── jquery-1.10.2.min.map ├── Tools │ ├── common.ps1 │ ├── install.ps1 │ ├── jquery-1.10.2.intellisense.js │ └── uninstall.ps1 └── jQuery.1.10.2.nupkg └── repositories.config /ApiWeb/ApiWeb.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | True 5 | False 6 | True 7 | 8 | False 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | CurrentPage 17 | True 18 | False 19 | False 20 | False 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | True 30 | True 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /ApiWeb/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web.Http; 5 | 6 | namespace ApiWeb 7 | { 8 | public static class WebApiConfig 9 | { 10 | public static void Register(HttpConfiguration config) 11 | { 12 | // Web API configuration and services 13 | 14 | // Web API routes 15 | config.MapHttpAttributeRoutes(); 16 | 17 | config.Routes.MapHttpRoute( 18 | name: "DefaultApi", 19 | routeTemplate: "api/{controller}/{id}", 20 | defaults: new { id = RouteParameter.Optional } 21 | ); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/ApiDescriptionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Web; 4 | using System.Web.Http.Description; 5 | 6 | namespace ApiWeb.Areas.HelpPage 7 | { 8 | public static class ApiDescriptionExtensions 9 | { 10 | /// 11 | /// Generates an URI-friendly ID for the . E.g. "Get-Values-id_name" instead of "GetValues/{id}?name={name}" 12 | /// 13 | /// The . 14 | /// The ID as a string. 15 | public static string GetFriendlyId(this ApiDescription description) 16 | { 17 | string path = description.RelativePath; 18 | string[] urlParts = path.Split('?'); 19 | string localPath = urlParts[0]; 20 | string queryKeyString = null; 21 | if (urlParts.Length > 1) 22 | { 23 | string query = urlParts[1]; 24 | string[] queryKeys = HttpUtility.ParseQueryString(query).AllKeys; 25 | queryKeyString = String.Join("_", queryKeys); 26 | } 27 | 28 | StringBuilder friendlyPath = new StringBuilder(); 29 | friendlyPath.AppendFormat("{0}-{1}", 30 | description.HttpMethod.Method, 31 | localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty)); 32 | if (queryKeyString != null) 33 | { 34 | friendlyPath.AppendFormat("_{0}", queryKeyString); 35 | } 36 | return friendlyPath.ToString(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/App_Start/HelpPageConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http.Headers; 4 | using System.Web; 5 | using System.Web.Http; 6 | 7 | namespace ApiWeb.Areas.HelpPage 8 | { 9 | /// 10 | /// Use this class to customize the Help Page. 11 | /// For example you can set a custom to supply the documentation 12 | /// or you can provide the samples for the requests/responses. 13 | /// 14 | public static class HelpPageConfig 15 | { 16 | public static void Register(HttpConfiguration config) 17 | { 18 | //// Uncomment the following to use the documentation from XML documentation file. 19 | //config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml"))); 20 | 21 | //// Uncomment the following to use "sample string" as the sample for all actions that have string as the body parameter or return type. 22 | //// Also, the string arrays will be used for IEnumerable. The sample objects will be serialized into different media type 23 | //// formats by the available formatters. 24 | //config.SetSampleObjects(new Dictionary 25 | //{ 26 | // {typeof(string), "sample string"}, 27 | // {typeof(IEnumerable), new string[]{"sample 1", "sample 2"}} 28 | //}); 29 | 30 | //// Uncomment the following to use "[0]=foo&[1]=bar" directly as the sample for all actions that support form URL encoded format 31 | //// and have IEnumerable as the body parameter or return type. 32 | //config.SetSampleForType("[0]=foo&[1]=bar", new MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(IEnumerable)); 33 | 34 | //// Uncomment the following to use "1234" directly as the request sample for media type "text/plain" on the controller named "Values" 35 | //// and action named "Put". 36 | //config.SetSampleRequest("1234", new MediaTypeHeaderValue("text/plain"), "Values", "Put"); 37 | 38 | //// Uncomment the following to use the image on "../images/aspNetHome.png" directly as the response sample for media type "image/png" 39 | //// on the controller named "Values" and action named "Get" with parameter "id". 40 | //config.SetSampleResponse(new ImageSample("../images/aspNetHome.png"), new MediaTypeHeaderValue("image/png"), "Values", "Get", "id"); 41 | 42 | //// Uncomment the following to correct the sample request when the action expects an HttpRequestMessage with ObjectContent. 43 | //// The sample will be generated as if the controller named "Values" and action named "Get" were having string as the body parameter. 44 | //config.SetActualRequestType(typeof(string), "Values", "Get"); 45 | 46 | //// Uncomment the following to correct the sample response when the action returns an HttpResponseMessage with ObjectContent. 47 | //// The sample will be generated as if the controller named "Values" and action named "Post" were returning a string. 48 | //config.SetActualResponseType(typeof(string), "Values", "Post"); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Controllers/HelpController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Http; 3 | using System.Web.Mvc; 4 | using ApiWeb.Areas.HelpPage.Models; 5 | 6 | namespace ApiWeb.Areas.HelpPage.Controllers 7 | { 8 | /// 9 | /// The controller that will handle requests for the help page. 10 | /// 11 | public class HelpController : Controller 12 | { 13 | public HelpController() 14 | : this(GlobalConfiguration.Configuration) 15 | { 16 | } 17 | 18 | public HelpController(HttpConfiguration config) 19 | { 20 | Configuration = config; 21 | } 22 | 23 | public HttpConfiguration Configuration { get; private set; } 24 | 25 | public ActionResult Index() 26 | { 27 | ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider(); 28 | return View(Configuration.Services.GetApiExplorer().ApiDescriptions); 29 | } 30 | 31 | public ActionResult Api(string apiId) 32 | { 33 | if (!String.IsNullOrEmpty(apiId)) 34 | { 35 | HelpPageApiModel apiModel = Configuration.GetHelpPageApiModel(apiId); 36 | if (apiModel != null) 37 | { 38 | return View(apiModel); 39 | } 40 | } 41 | 42 | return View("Error"); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/HelpPage.css: -------------------------------------------------------------------------------- 1 | pre.wrapped { 2 | white-space: -moz-pre-wrap; 3 | white-space: -pre-wrap; 4 | white-space: -o-pre-wrap; 5 | white-space: pre-wrap; 6 | } 7 | 8 | .warning-message-container { 9 | margin-top: 20px; 10 | padding: 0 10px; 11 | color: #525252; 12 | background: #EFDCA9; 13 | border: 1px solid #CCCCCC; 14 | } 15 | 16 | .help-page-table { 17 | width: 100%; 18 | border-collapse: collapse; 19 | text-align: left; 20 | margin: 0px 0px 20px 0px; 21 | border-top: 2px solid #D4D4D4; 22 | } 23 | 24 | .help-page-table th { 25 | text-align: left; 26 | font-weight: bold; 27 | border-bottom: 2px solid #D4D4D4; 28 | padding: 8px 6px 8px 6px; 29 | } 30 | 31 | .help-page-table td { 32 | border-bottom: 2px solid #D4D4D4; 33 | padding: 15px 8px 15px 8px; 34 | vertical-align: top; 35 | } 36 | 37 | .help-page-table pre, .help-page-table p { 38 | margin: 0px; 39 | padding: 0px; 40 | font-family: inherit; 41 | font-size: 100%; 42 | } 43 | 44 | .help-page-table tbody tr:hover td { 45 | background-color: #F3F3F3; 46 | } 47 | 48 | a:hover { 49 | background-color: transparent; 50 | } 51 | 52 | .sample-header { 53 | border: 2px solid #D4D4D4; 54 | background: #76B8DB; 55 | color: #FFFFFF; 56 | padding: 8px 15px; 57 | border-bottom: none; 58 | display: inline-block; 59 | margin: 10px 0px 0px 0px; 60 | } 61 | 62 | .sample-content { 63 | display: block; 64 | border-width: 0; 65 | padding: 15px 20px; 66 | background: #FFFFFF; 67 | border: 2px solid #D4D4D4; 68 | margin: 0px 0px 10px 0px; 69 | } 70 | 71 | .api-name { 72 | width: 40%; 73 | } 74 | 75 | .api-documentation { 76 | width: 60%; 77 | } 78 | 79 | .parameter-name { 80 | width: 20%; 81 | } 82 | 83 | .parameter-documentation { 84 | width: 50%; 85 | } 86 | 87 | .parameter-source { 88 | width: 30%; 89 | } 90 | -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/HelpPageAreaRegistration.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using System.Web.Mvc; 3 | 4 | namespace ApiWeb.Areas.HelpPage 5 | { 6 | public class HelpPageAreaRegistration : AreaRegistration 7 | { 8 | public override string AreaName 9 | { 10 | get 11 | { 12 | return "HelpPage"; 13 | } 14 | } 15 | 16 | public override void RegisterArea(AreaRegistrationContext context) 17 | { 18 | context.MapRoute( 19 | "HelpPage_Default", 20 | "Help/{action}/{apiId}", 21 | new { controller = "Help", action = "Index", apiId = UrlParameter.Optional }); 22 | 23 | HelpPageConfig.Register(GlobalConfiguration.Configuration); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Models/HelpPageApiModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.ObjectModel; 3 | using System.Net.Http.Headers; 4 | using System.Web.Http.Description; 5 | 6 | namespace ApiWeb.Areas.HelpPage.Models 7 | { 8 | /// 9 | /// The model that represents an API displayed on the help page. 10 | /// 11 | public class HelpPageApiModel 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public HelpPageApiModel() 17 | { 18 | SampleRequests = new Dictionary(); 19 | SampleResponses = new Dictionary(); 20 | ErrorMessages = new Collection(); 21 | } 22 | 23 | /// 24 | /// Gets or sets the that describes the API. 25 | /// 26 | public ApiDescription ApiDescription { get; set; } 27 | 28 | /// 29 | /// Gets the sample requests associated with the API. 30 | /// 31 | public IDictionary SampleRequests { get; private set; } 32 | 33 | /// 34 | /// Gets the sample responses associated with the API. 35 | /// 36 | public IDictionary SampleResponses { get; private set; } 37 | 38 | /// 39 | /// Gets the error messages associated with this model. 40 | /// 41 | public Collection ErrorMessages { get; private set; } 42 | } 43 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/SampleGeneration/HelpPageSampleKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Net.Http.Headers; 5 | 6 | namespace ApiWeb.Areas.HelpPage 7 | { 8 | /// 9 | /// This is used to identify the place where the sample should be applied. 10 | /// 11 | public class HelpPageSampleKey 12 | { 13 | /// 14 | /// Creates a new based on media type and CLR type. 15 | /// 16 | /// The media type. 17 | /// The CLR type. 18 | public HelpPageSampleKey(MediaTypeHeaderValue mediaType, Type type) 19 | { 20 | if (mediaType == null) 21 | { 22 | throw new ArgumentNullException("mediaType"); 23 | } 24 | if (type == null) 25 | { 26 | throw new ArgumentNullException("type"); 27 | } 28 | ControllerName = String.Empty; 29 | ActionName = String.Empty; 30 | ParameterNames = new HashSet(StringComparer.OrdinalIgnoreCase); 31 | ParameterType = type; 32 | MediaType = mediaType; 33 | } 34 | 35 | /// 36 | /// Creates a new based on , controller name, action name and parameter names. 37 | /// 38 | /// The . 39 | /// Name of the controller. 40 | /// Name of the action. 41 | /// The parameter names. 42 | public HelpPageSampleKey(SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable parameterNames) 43 | { 44 | if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection)) 45 | { 46 | throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection)); 47 | } 48 | if (controllerName == null) 49 | { 50 | throw new ArgumentNullException("controllerName"); 51 | } 52 | if (actionName == null) 53 | { 54 | throw new ArgumentNullException("actionName"); 55 | } 56 | if (parameterNames == null) 57 | { 58 | throw new ArgumentNullException("parameterNames"); 59 | } 60 | ControllerName = controllerName; 61 | ActionName = actionName; 62 | ParameterNames = new HashSet(parameterNames, StringComparer.OrdinalIgnoreCase); 63 | SampleDirection = sampleDirection; 64 | } 65 | 66 | /// 67 | /// Creates a new based on media type, , controller name, action name and parameter names. 68 | /// 69 | /// The media type. 70 | /// The . 71 | /// Name of the controller. 72 | /// Name of the action. 73 | /// The parameter names. 74 | public HelpPageSampleKey(MediaTypeHeaderValue mediaType, SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable parameterNames) 75 | { 76 | if (mediaType == null) 77 | { 78 | throw new ArgumentNullException("mediaType"); 79 | } 80 | if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection)) 81 | { 82 | throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection)); 83 | } 84 | if (controllerName == null) 85 | { 86 | throw new ArgumentNullException("controllerName"); 87 | } 88 | if (actionName == null) 89 | { 90 | throw new ArgumentNullException("actionName"); 91 | } 92 | if (parameterNames == null) 93 | { 94 | throw new ArgumentNullException("parameterNames"); 95 | } 96 | ControllerName = controllerName; 97 | ActionName = actionName; 98 | MediaType = mediaType; 99 | ParameterNames = new HashSet(parameterNames, StringComparer.OrdinalIgnoreCase); 100 | SampleDirection = sampleDirection; 101 | } 102 | 103 | /// 104 | /// Gets the name of the controller. 105 | /// 106 | /// 107 | /// The name of the controller. 108 | /// 109 | public string ControllerName { get; private set; } 110 | 111 | /// 112 | /// Gets the name of the action. 113 | /// 114 | /// 115 | /// The name of the action. 116 | /// 117 | public string ActionName { get; private set; } 118 | 119 | /// 120 | /// Gets the media type. 121 | /// 122 | /// 123 | /// The media type. 124 | /// 125 | public MediaTypeHeaderValue MediaType { get; private set; } 126 | 127 | /// 128 | /// Gets the parameter names. 129 | /// 130 | public HashSet ParameterNames { get; private set; } 131 | 132 | public Type ParameterType { get; private set; } 133 | 134 | /// 135 | /// Gets the . 136 | /// 137 | public SampleDirection? SampleDirection { get; private set; } 138 | 139 | public override bool Equals(object obj) 140 | { 141 | HelpPageSampleKey otherKey = obj as HelpPageSampleKey; 142 | if (otherKey == null) 143 | { 144 | return false; 145 | } 146 | 147 | return String.Equals(ControllerName, otherKey.ControllerName, StringComparison.OrdinalIgnoreCase) && 148 | String.Equals(ActionName, otherKey.ActionName, StringComparison.OrdinalIgnoreCase) && 149 | (MediaType == otherKey.MediaType || (MediaType != null && MediaType.Equals(otherKey.MediaType))) && 150 | ParameterType == otherKey.ParameterType && 151 | SampleDirection == otherKey.SampleDirection && 152 | ParameterNames.SetEquals(otherKey.ParameterNames); 153 | } 154 | 155 | public override int GetHashCode() 156 | { 157 | int hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode(); 158 | if (MediaType != null) 159 | { 160 | hashCode ^= MediaType.GetHashCode(); 161 | } 162 | if (SampleDirection != null) 163 | { 164 | hashCode ^= SampleDirection.GetHashCode(); 165 | } 166 | if (ParameterType != null) 167 | { 168 | hashCode ^= ParameterType.GetHashCode(); 169 | } 170 | foreach (string parameterName in ParameterNames) 171 | { 172 | hashCode ^= parameterName.ToUpperInvariant().GetHashCode(); 173 | } 174 | 175 | return hashCode; 176 | } 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/SampleGeneration/ImageSample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ApiWeb.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents an image sample on the help page. There's a display template named ImageSample associated with this class. 7 | /// 8 | public class ImageSample 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The URL of an image. 14 | public ImageSample(string src) 15 | { 16 | if (src == null) 17 | { 18 | throw new ArgumentNullException("src"); 19 | } 20 | Src = src; 21 | } 22 | 23 | public string Src { get; private set; } 24 | 25 | public override bool Equals(object obj) 26 | { 27 | ImageSample other = obj as ImageSample; 28 | return other != null && Src == other.Src; 29 | } 30 | 31 | public override int GetHashCode() 32 | { 33 | return Src.GetHashCode(); 34 | } 35 | 36 | public override string ToString() 37 | { 38 | return Src; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/SampleGeneration/InvalidSample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ApiWeb.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents an invalid sample on the help page. There's a display template named InvalidSample associated with this class. 7 | /// 8 | public class InvalidSample 9 | { 10 | public InvalidSample(string errorMessage) 11 | { 12 | if (errorMessage == null) 13 | { 14 | throw new ArgumentNullException("errorMessage"); 15 | } 16 | ErrorMessage = errorMessage; 17 | } 18 | 19 | public string ErrorMessage { get; private set; } 20 | 21 | public override bool Equals(object obj) 22 | { 23 | InvalidSample other = obj as InvalidSample; 24 | return other != null && ErrorMessage == other.ErrorMessage; 25 | } 26 | 27 | public override int GetHashCode() 28 | { 29 | return ErrorMessage.GetHashCode(); 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return ErrorMessage; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/SampleGeneration/SampleDirection.cs: -------------------------------------------------------------------------------- 1 | namespace ApiWeb.Areas.HelpPage 2 | { 3 | /// 4 | /// Indicates whether the sample is used for request or response 5 | /// 6 | public enum SampleDirection 7 | { 8 | Request = 0, 9 | Response 10 | } 11 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/SampleGeneration/TextSample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ApiWeb.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents a preformatted text sample on the help page. There's a display template named TextSample associated with this class. 7 | /// 8 | public class TextSample 9 | { 10 | public TextSample(string text) 11 | { 12 | if (text == null) 13 | { 14 | throw new ArgumentNullException("text"); 15 | } 16 | Text = text; 17 | } 18 | 19 | public string Text { get; private set; } 20 | 21 | public override bool Equals(object obj) 22 | { 23 | TextSample other = obj as TextSample; 24 | return other != null && Text == other.Text; 25 | } 26 | 27 | public override int GetHashCode() 28 | { 29 | return Text.GetHashCode(); 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return Text; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/Api.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using ApiWeb.Areas.HelpPage.Models 3 | @model HelpPageApiModel 4 | 5 | @{ 6 | var description = Model.ApiDescription; 7 | ViewBag.Title = description.HttpMethod.Method + " " + description.RelativePath; 8 | } 9 | 10 |
11 | 18 |
19 | @Html.DisplayFor(m => Model) 20 |
21 |
22 | 23 | @section Scripts { 24 | 25 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using System.Web.Http.Controllers 3 | @using System.Web.Http.Description 4 | @using ApiWeb.Areas.HelpPage 5 | @using ApiWeb.Areas.HelpPage.Models 6 | @model IGrouping 7 | 8 | @{ 9 | var controllerDocumentation = ViewBag.DocumentationProvider != null ? 10 | ViewBag.DocumentationProvider.GetDocumentation(Model.Key) : 11 | null; 12 | } 13 | 14 |

@Model.Key.ControllerName

15 | @if (!String.IsNullOrEmpty(controllerDocumentation)) 16 | { 17 |

@controllerDocumentation

18 | } 19 | 20 | 21 | 22 | 23 | 24 | @foreach (var api in Model) 25 | { 26 | 27 | 28 | 38 | 39 | } 40 | 41 |
APIDescription
@api.HttpMethod.Method @api.RelativePath 29 | @if (api.Documentation != null) 30 | { 31 |

@api.Documentation

32 | } 33 | else 34 | { 35 |

No documentation available.

36 | } 37 |
-------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/DisplayTemplates/HelpPageApiModel.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using ApiWeb.Areas.HelpPage.Models 3 | @model HelpPageApiModel 4 | 5 | @{ 6 | var description = Model.ApiDescription; 7 | bool hasParameters = description.ParameterDescriptions.Count > 0; 8 | bool hasRequestSamples = Model.SampleRequests.Count > 0; 9 | bool hasResponseSamples = Model.SampleResponses.Count > 0; 10 | } 11 |

@description.HttpMethod.Method @description.RelativePath

12 |
13 | @if (description.Documentation != null) 14 | { 15 |

@description.Documentation

16 | } 17 | else 18 | { 19 |

No documentation available.

20 | } 21 | 22 | @if (hasParameters || hasRequestSamples) 23 | { 24 |

Request Information

25 | if (hasParameters) 26 | { 27 |

Parameters

28 | @Html.DisplayFor(apiModel => apiModel.ApiDescription.ParameterDescriptions, "Parameters") 29 | } 30 | if (hasRequestSamples) 31 | { 32 |

Request body formats

33 | @Html.DisplayFor(apiModel => apiModel.SampleRequests, "Samples") 34 | } 35 | } 36 | 37 | @if (hasResponseSamples) 38 | { 39 |

Response Information

40 | if (description.ResponseDescription.Documentation != null) 41 | { 42 |

@description.ResponseDescription.Documentation

43 | } 44 | else 45 | { 46 |

No documentation available.

47 | } 48 |

Response body formats

49 | @Html.DisplayFor(apiModel => apiModel.SampleResponses, "Samples") 50 | } 51 |
-------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/DisplayTemplates/ImageSample.cshtml: -------------------------------------------------------------------------------- 1 | @using ApiWeb.Areas.HelpPage 2 | @model ImageSample 3 | 4 | -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/DisplayTemplates/InvalidSample.cshtml: -------------------------------------------------------------------------------- 1 | @using ApiWeb.Areas.HelpPage 2 | @model InvalidSample 3 | 4 | @if (HttpContext.Current.IsDebuggingEnabled) 5 | { 6 |
7 |

@Model.ErrorMessage

8 |
9 | } 10 | else 11 | { 12 |

Sample not available.

13 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/DisplayTemplates/Parameters.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Collections.ObjectModel 2 | @using System.Web.Http.Description 3 | @using System.Threading 4 | @model Collection 5 | 6 | 7 | 8 | 9 | 10 | 11 | @foreach (ApiParameterDescription parameter in Model) 12 | { 13 | string parameterDocumentation = parameter.Documentation != null ? 14 | parameter.Documentation : 15 | "No documentation available."; 16 | 17 | // Don't show CancellationToken because it's a special parameter 18 | if (parameter.ParameterDescriptor == null || 19 | (parameter.ParameterDescriptor != null && 20 | !typeof(CancellationToken).IsAssignableFrom(parameter.ParameterDescriptor.ParameterType))) 21 | { 22 | 23 | 24 | 25 | 40 | 41 | } 42 | } 43 | 44 |
NameDescriptionAdditional information
@parameter.Name
@parameterDocumentation
26 | @switch (parameter.Source) 27 | { 28 | case ApiParameterSource.FromBody: 29 |

Define this parameter in the request body.

30 | break; 31 | case ApiParameterSource.FromUri: 32 |

Define this parameter in the request URI.

33 | break; 34 | case ApiParameterSource.Unknown: 35 | default: 36 |

None.

37 | break; 38 | } 39 |
-------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/DisplayTemplates/Samples.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Net.Http.Headers 2 | @model Dictionary 3 | 4 | @{ 5 | // Group the samples into a single tab if they are the same. 6 | Dictionary samples = Model.GroupBy(pair => pair.Value).ToDictionary( 7 | pair => String.Join(", ", pair.Select(m => m.Key.ToString()).ToArray()), 8 | pair => pair.Key); 9 | var mediaTypes = samples.Keys; 10 | } 11 |
12 | @foreach (var mediaType in mediaTypes) 13 | { 14 |

@mediaType

15 |
16 | Sample: 17 | @{ 18 | var sample = samples[mediaType]; 19 | if (sample == null) 20 | { 21 |

Sample not available.

22 | } 23 | else 24 | { 25 | @Html.DisplayFor(s => sample); 26 | } 27 | } 28 |
29 | } 30 |
-------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/DisplayTemplates/TextSample.cshtml: -------------------------------------------------------------------------------- 1 | @using ApiWeb.Areas.HelpPage 2 | @model TextSample 3 | 4 |
5 | @Model.Text
6 | 
-------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Help/Index.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using System.Web.Http.Controllers 3 | @using System.Web.Http.Description 4 | @using System.Collections.ObjectModel 5 | @using ApiWeb.Areas.HelpPage.Models 6 | @model Collection 7 | 8 | @{ 9 | ViewBag.Title = "ASP.NET Web API Help Page"; 10 | 11 | // Group APIs by controller 12 | ILookup apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor); 13 | } 14 | 15 |
16 |
17 |
18 |

@ViewBag.Title

19 |
20 |
21 |
22 |
23 | 31 |
32 | @foreach (var group in apiGroups) 33 | { 34 | @Html.DisplayFor(m => group, "ApiGroup") 35 | } 36 |
37 |
38 | 39 | @section Scripts { 40 | 41 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @ViewBag.Title 7 | @RenderSection("scripts", required: false) 8 | 9 | 10 | @RenderBody() 11 | 12 | -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 43 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | // Change the Layout path below to blend the look and feel of the help page with your existing web pages 3 | Layout = "~/Views/Shared/_Layout.cshtml"; 4 | } -------------------------------------------------------------------------------- /ApiWeb/Areas/HelpPage/XmlDocumentationProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Web.Http.Controllers; 6 | using System.Web.Http.Description; 7 | using System.Xml.XPath; 8 | 9 | namespace ApiWeb.Areas.HelpPage 10 | { 11 | /// 12 | /// A custom that reads the API documentation from an XML documentation file. 13 | /// 14 | public class XmlDocumentationProvider : IDocumentationProvider 15 | { 16 | private XPathNavigator _documentNavigator; 17 | private const string TypeExpression = "/doc/members/member[@name='T:{0}']"; 18 | private const string MethodExpression = "/doc/members/member[@name='M:{0}']"; 19 | private const string ParameterExpression = "param[@name='{0}']"; 20 | 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The physical path to XML document. 25 | public XmlDocumentationProvider(string documentPath) 26 | { 27 | if (documentPath == null) 28 | { 29 | throw new ArgumentNullException("documentPath"); 30 | } 31 | XPathDocument xpath = new XPathDocument(documentPath); 32 | _documentNavigator = xpath.CreateNavigator(); 33 | } 34 | 35 | public string GetDocumentation(HttpControllerDescriptor controllerDescriptor) 36 | { 37 | XPathNavigator typeNode = GetTypeNode(controllerDescriptor); 38 | return GetTagValue(typeNode, "summary"); 39 | } 40 | 41 | public virtual string GetDocumentation(HttpActionDescriptor actionDescriptor) 42 | { 43 | XPathNavigator methodNode = GetMethodNode(actionDescriptor); 44 | return GetTagValue(methodNode, "summary"); 45 | } 46 | 47 | public virtual string GetDocumentation(HttpParameterDescriptor parameterDescriptor) 48 | { 49 | ReflectedHttpParameterDescriptor reflectedParameterDescriptor = parameterDescriptor as ReflectedHttpParameterDescriptor; 50 | if (reflectedParameterDescriptor != null) 51 | { 52 | XPathNavigator methodNode = GetMethodNode(reflectedParameterDescriptor.ActionDescriptor); 53 | if (methodNode != null) 54 | { 55 | string parameterName = reflectedParameterDescriptor.ParameterInfo.Name; 56 | XPathNavigator parameterNode = methodNode.SelectSingleNode(String.Format(CultureInfo.InvariantCulture, ParameterExpression, parameterName)); 57 | if (parameterNode != null) 58 | { 59 | return parameterNode.Value.Trim(); 60 | } 61 | } 62 | } 63 | 64 | return null; 65 | } 66 | 67 | public string GetResponseDocumentation(HttpActionDescriptor actionDescriptor) 68 | { 69 | XPathNavigator methodNode = GetMethodNode(actionDescriptor); 70 | return GetTagValue(methodNode, "returns"); 71 | } 72 | 73 | private XPathNavigator GetMethodNode(HttpActionDescriptor actionDescriptor) 74 | { 75 | ReflectedHttpActionDescriptor reflectedActionDescriptor = actionDescriptor as ReflectedHttpActionDescriptor; 76 | if (reflectedActionDescriptor != null) 77 | { 78 | string selectExpression = String.Format(CultureInfo.InvariantCulture, MethodExpression, GetMemberName(reflectedActionDescriptor.MethodInfo)); 79 | return _documentNavigator.SelectSingleNode(selectExpression); 80 | } 81 | 82 | return null; 83 | } 84 | 85 | private static string GetMemberName(MethodInfo method) 86 | { 87 | string name = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", method.DeclaringType.FullName, method.Name); 88 | ParameterInfo[] parameters = method.GetParameters(); 89 | if (parameters.Length != 0) 90 | { 91 | string[] parameterTypeNames = parameters.Select(param => GetTypeName(param.ParameterType)).ToArray(); 92 | name += String.Format(CultureInfo.InvariantCulture, "({0})", String.Join(",", parameterTypeNames)); 93 | } 94 | 95 | return name; 96 | } 97 | 98 | private static string GetTagValue(XPathNavigator parentNode, string tagName) 99 | { 100 | if (parentNode != null) 101 | { 102 | XPathNavigator node = parentNode.SelectSingleNode(tagName); 103 | if (node != null) 104 | { 105 | return node.Value.Trim(); 106 | } 107 | } 108 | 109 | return null; 110 | } 111 | 112 | private static string GetTypeName(Type type) 113 | { 114 | if (type.IsGenericType) 115 | { 116 | // Format the generic type name to something like: Generic{System.Int32,System.String} 117 | Type genericType = type.GetGenericTypeDefinition(); 118 | Type[] genericArguments = type.GetGenericArguments(); 119 | string typeName = genericType.FullName; 120 | 121 | // Trim the generic parameter counts from the name 122 | typeName = typeName.Substring(0, typeName.IndexOf('`')); 123 | string[] argumentTypeNames = genericArguments.Select(t => GetTypeName(t)).ToArray(); 124 | return String.Format(CultureInfo.InvariantCulture, "{0}{{{1}}}", typeName, String.Join(",", argumentTypeNames)); 125 | } 126 | 127 | return type.FullName; 128 | } 129 | 130 | private XPathNavigator GetTypeNode(HttpControllerDescriptor controllerDescriptor) 131 | { 132 | Type controllerType = controllerDescriptor.ControllerType; 133 | string controllerTypeName = controllerType.FullName; 134 | if (controllerType.IsNested) 135 | { 136 | // Changing the nested type name from OuterType+InnerType to OuterType.InnerType to match the XML documentation syntax. 137 | controllerTypeName = controllerTypeName.Replace("+", "."); 138 | } 139 | string selectExpression = String.Format(CultureInfo.InvariantCulture, TypeExpression, controllerTypeName); 140 | return _documentNavigator.SelectSingleNode(selectExpression); 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /ApiWeb/Controllers/BaseController.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Net.Http; 6 | using System.Web; 7 | using System.Web.Http; 8 | using System.Web.Mvc; 9 | 10 | namespace ApiWeb.Controllers 11 | { 12 | public class BaseController : ApiController 13 | { 14 | public HttpResponseMessage GetHttpResponseMessage(object result) 15 | { 16 | return new HttpResponseMessage() 17 | { 18 | Content = 19 | new StringContent(JsonConvert.SerializeObject(result), System.Text.Encoding.UTF8, 20 | "application/json") 21 | }; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /ApiWeb/Controllers/TestApiController.cs: -------------------------------------------------------------------------------- 1 | using ApiWeb.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Net.Http; 6 | using System.Threading; 7 | using System.Web.Http; 8 | 9 | namespace ApiWeb.Controllers 10 | { 11 | /// 12 | /// 接口提供方-都提供了根据年龄获取对应学生信息的接口 13 | /// 14 | public class TestApiController : BaseController 15 | { 16 | /// 17 | /// 初始化测试数据 18 | /// 19 | private List stulist = new List() { 20 | new stu() { Name = "joy", Age = 19 }, 21 | new stu() { Name = "steve", Age = 29 }, 22 | new stu() { Name = "james", Age = 39 }, 23 | new stu() { Name = "rio", Age = 49 }, 24 | new stu() { Name = "tom", Age = 79 }, 25 | new stu() { Name = "jerry", Age = 20 }, 26 | new stu() { Name = "jim", Age = 21 }, 27 | new stu() { Name = "jack", Age = 22 }, 28 | new stu() { Name = "jeef", Age = 23 }, 29 | new stu() { Name = "thomas", Age = 24 }, 30 | new stu() { Name = "martin", Age = 20 }, 31 | new stu() { Name = "bill", Age = 25 } 32 | }; 33 | 34 | /// 35 | /// 接口对外公开 36 | /// 37 | /// 38 | [HttpGet] 39 | [Route("NoSecure")] 40 | public HttpResponseMessage NoSecure(int age) 41 | { 42 | var result = new ResultModel() 43 | { 44 | ReturnCode = 0, 45 | Message = string.Empty, 46 | Result = string.Empty 47 | }; 48 | 49 | var dataResult = stulist.Where(T => T.Age == age).ToList(); 50 | result.Result = dataResult; 51 | 52 | return GetHttpResponseMessage(result); 53 | } 54 | 55 | /// 56 | /// 接口加密 57 | /// 58 | /// 59 | [HttpGet] 60 | [Route("SecureBySign")] 61 | public HttpResponseMessage SecureBySign([FromUri]int age, long _timestamp, string appKey, string _sign) 62 | { 63 | var result = new ResultModel() 64 | { 65 | ReturnCode = 0, 66 | Message = string.Empty, 67 | Result = string.Empty 68 | }; 69 | 70 | #region 校验签名是否合法 71 | var param = new SortedDictionary(new AsciiComparer()); 72 | param.Add("age", age.ToString()); 73 | param.Add("appKey", appKey); 74 | param.Add("_timestamp", _timestamp.ToString()); 75 | 76 | string currentSign = SignHelper.GetSign(param, appKey); 77 | 78 | if (_sign != currentSign) 79 | { 80 | result.ReturnCode = -2; 81 | result.Message = "签名不合法"; 82 | return GetHttpResponseMessage(result); 83 | } 84 | #endregion 85 | 86 | var dataResult = stulist.Where(T => T.Age == age).ToList(); 87 | result.Result = dataResult; 88 | 89 | return GetHttpResponseMessage(result); 90 | } 91 | 92 | /// 93 | /// 接口加密并根据时间戳判断有效性 94 | /// 95 | /// 96 | [HttpGet] 97 | [Route("SecureBySign/Expired")] 98 | public HttpResponseMessage SecureBySign_Expired([FromUri]int age, long _timestamp, string appKey, string _sign) 99 | { 100 | var result = new ResultModel() 101 | { 102 | ReturnCode = 0, 103 | Message = string.Empty, 104 | Result = string.Empty 105 | }; 106 | 107 | #region 判断请求是否过期---假设过期时间是20秒 108 | DateTime requestTime = GetDateTimeByTicks(_timestamp); 109 | 110 | if (requestTime.AddSeconds(20) < DateTime.Now) 111 | { 112 | result.ReturnCode = -1; 113 | result.Message = "接口过期"; 114 | return GetHttpResponseMessage(result); 115 | } 116 | #endregion 117 | 118 | #region 校验签名是否合法 119 | var param = new SortedDictionary(new AsciiComparer()); 120 | param.Add("age", age.ToString()); 121 | param.Add("appKey", appKey); 122 | param.Add("_timestamp", _timestamp.ToString()); 123 | 124 | string currentSign = SignHelper.GetSign(param, appKey); 125 | 126 | if (_sign != currentSign) 127 | { 128 | result.ReturnCode = -2; 129 | result.Message = "签名不合法"; 130 | return GetHttpResponseMessage(result); 131 | } 132 | #endregion 133 | 134 | var dataResult = stulist.Where(T => T.Age == age).ToList(); 135 | result.Result = dataResult; 136 | 137 | return GetHttpResponseMessage(result); 138 | } 139 | 140 | /// 141 | /// 接口加密并根据时间戳判断有效性而且带着私有key校验 142 | /// 143 | /// 144 | [HttpGet] 145 | [Route("SecureBySign/Expired/KeySecret")] 146 | public HttpResponseMessage SecureBySign_Expired_KeySecret([FromUri]int age, long _timestamp, string appKey, string _sign) 147 | { 148 | //key集合,这里随便弄两个测试数据 149 | //如果调用方比较多,需要审核授权,根据一定的规则生成key把这些数据存放在数据库中,如果功能扩展开来,可以针对不同的调用方做不同的功能权限管理 150 | //在调用接口时动态从库里取,每个调用方在调用时带上他的key,调用方一般把自己的key放到网站配置中 151 | Dictionary keySecretDic = new Dictionary(); 152 | keySecretDic.Add("key_zhangsan", "D9U7YY5D7FF2748AED89E90HJ88881E6");//张三的key, 153 | keySecretDic.Add("key_lisi", "I9O6ZZ3D7FF2748AED89E90ZB7732M9");//李四的key 154 | 155 | var result = new ResultModel() 156 | { 157 | ReturnCode = 0, 158 | Message = string.Empty, 159 | Result = string.Empty 160 | }; 161 | 162 | #region 判断请求是否过期---假设过期时间是20秒 163 | DateTime requestTime = GetDateTimeByTicks(_timestamp); 164 | 165 | if (requestTime.AddSeconds(20) < DateTime.Now) 166 | { 167 | result.ReturnCode = -1; 168 | result.Message = "接口过期"; 169 | return GetHttpResponseMessage(result); 170 | } 171 | #endregion 172 | 173 | #region 根据appkey获取key值 174 | string secret = keySecretDic.Where(T => T.Key == appKey).FirstOrDefault().Value; 175 | #endregion 176 | 177 | #region 校验签名是否合法 178 | var param = new SortedDictionary(new AsciiComparer()); 179 | param.Add("age", age.ToString()); 180 | param.Add("appKey", appKey); 181 | 182 | param.Add("appSecret", secret);//把secret加入进行加密 183 | 184 | param.Add("_timestamp", _timestamp.ToString()); 185 | 186 | string currentSign = SignHelper.GetSign(param, appKey); 187 | 188 | if (_sign != currentSign) 189 | { 190 | result.ReturnCode = -2; 191 | result.Message = "签名不合法"; 192 | return GetHttpResponseMessage(result); 193 | } 194 | #endregion 195 | 196 | var dataResult = stulist.Where(T => T.Age == age).ToList(); 197 | result.Result = dataResult; 198 | 199 | return GetHttpResponseMessage(result); 200 | } 201 | 202 | 203 | #region 辅助方法 204 | 205 | /// 206 | /// 时间戳转换为时间 207 | /// 208 | /// 209 | /// 210 | private DateTime GetDateTimeByTicks(long ticks) 211 | { 212 | return new DateTime(ticks); 213 | } 214 | 215 | #endregion 216 | } 217 | 218 | 219 | /// 220 | /// 测试数据类 221 | /// 222 | class stu 223 | { 224 | public string Name { get; set; } 225 | public int Age { get; set; } 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /ApiWeb/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="ApiWeb.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /ApiWeb/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Http; 6 | using System.Web.Mvc; 7 | using System.Web.Optimization; 8 | using System.Web.Routing; 9 | 10 | namespace ApiWeb 11 | { 12 | public class WebApiApplication : System.Web.HttpApplication 13 | { 14 | protected void Application_Start() 15 | { 16 | GlobalConfiguration.Configure(WebApiConfig.Register); 17 | 18 | } 19 | 20 | protected void Application_Error(object sender, EventArgs e) 21 | { 22 | 23 | Exception ex = System.Web.HttpContext.Current.Server.GetLastError().GetBaseException(); 24 | string message = ex.ToString() + "\r\n"; 25 | if (System.Web.HttpContext.Current.Request.UrlReferrer != null) 26 | { 27 | message += System.Web.HttpContext.Current.Request.UrlReferrer.ToString(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ApiWeb/Models/AsciiComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace ApiWeb.Models 7 | { 8 | /// 9 | /// 基于ASCII码排序规则的String比较器 10 | /// 11 | public class AsciiComparer : System.Collections.Generic.IComparer 12 | { 13 | public int Compare(string a, string b) 14 | { 15 | if (a == b) 16 | return 0; 17 | else if (string.IsNullOrEmpty(a)) 18 | return -1; 19 | else if (string.IsNullOrEmpty(b)) 20 | return 1; 21 | if (a.Length <= b.Length) 22 | { 23 | for (int i = 0; i < a.Length; i++) 24 | { 25 | if (a[i] < b[i]) 26 | return -1; 27 | else if (a[i] > b[i]) 28 | return 1; 29 | else 30 | continue; 31 | } 32 | return a.Length == b.Length ? 0 : -1; 33 | } 34 | else 35 | { 36 | for (int i = 0; i < b.Length; i++) 37 | { 38 | if (a[i] < b[i]) 39 | return -1; 40 | else if (a[i] > b[i]) 41 | return 1; 42 | else 43 | continue; 44 | } 45 | return 1; 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /ApiWeb/Models/ResultModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace ApiWeb.Models 7 | { 8 | /// 9 | /// 统一接口Json返回结果格式 10 | /// 11 | /// 12 | public class ResultModel where T : class 13 | { 14 | /// 15 | /// 状态码 16 | /// 17 | public int ReturnCode { get; set; } 18 | 19 | /// 20 | /// 附加消息 21 | /// 22 | public string Message { get; set; } 23 | 24 | /// 25 | /// 附加数据 26 | /// 27 | public T Result { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /ApiWeb/Models/SignHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | 7 | namespace ApiWeb.Models 8 | { 9 | public class SignHelper 10 | { 11 | public static string GetSign(SortedDictionary paramList, string appKey = "") 12 | { 13 | paramList.Remove("_sign"); 14 | StringBuilder sb = new StringBuilder(appKey); 15 | foreach (var p in paramList) 16 | sb.Append(p.Key).Append(p.Value); 17 | sb.Append(appKey); 18 | return GetMD5(sb.ToString()); 19 | } 20 | public static string GetMD5(string str) 21 | { 22 | if (string.IsNullOrEmpty(str)) 23 | return str; 24 | var sb = new StringBuilder(32); 25 | var md5 = System.Security.Cryptography.MD5.Create(); 26 | var output = md5.ComputeHash(Encoding.UTF8.GetBytes(str)); 27 | for (int i = 0; i < output.Length; i++) 28 | sb.Append(output[i].ToString("X").PadLeft(2, '0')); 29 | return sb.ToString(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /ApiWeb/Project_Readme.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 你的 ASP.NET 应用程序 7 | 96 | 97 | 98 | 99 | 103 | 104 |
105 |
106 |

此应用程序包含:

107 |
    108 |
  • 用于记录你的 Web API 的帮助页
  • 109 |
  • 使用 Bootstrap 进行主题定位
  • 110 |
  • 身份验证,如果选择此项,则将显示如何注册和登录
  • 111 |
  • 使用 NuGet 管理的 ASP.NET 功能
  • 112 |
113 |
114 | 115 | 131 | 132 |
133 |

部署

134 | 139 |
140 | 141 |
142 |

获取帮助

143 | 147 |
148 |
149 | 150 | 151 | -------------------------------------------------------------------------------- /ApiWeb/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息是通过以下项进行控制的 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ApiWeb")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("ApiWeb")] 13 | [assembly: AssemblyCopyright("版权所有(C) Microsoft 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 将使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要 19 | // 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID 23 | [assembly: Guid("652e57b9-cda2-4c83-9415-a8ecb6c6e7b8")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订版本 31 | // 32 | // 你可以指定所有值,也可以让修订版本和内部版本号采用默认值, 33 | // 方法是按如下所示使用 "*": 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /ApiWeb/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /ApiWeb/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /ApiWeb/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /ApiWeb/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ApiWeb/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ApiWeb/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/ApiWeb/favicon.ico -------------------------------------------------------------------------------- /ApiWeb/obj/Debug/ApiWeb.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\Site\Demo\WebDemo\ApiWeb\bin\ApiWeb.dll.config 2 | D:\Site\Demo\WebDemo\ApiWeb\bin\ApiWeb.dll 3 | D:\Site\Demo\WebDemo\ApiWeb\bin\ApiWeb.pdb 4 | D:\Site\Demo\WebDemo\ApiWeb\bin\Antlr3.Runtime.dll 5 | D:\Site\Demo\WebDemo\ApiWeb\bin\Microsoft.Web.Infrastructure.dll 6 | D:\Site\Demo\WebDemo\ApiWeb\bin\Newtonsoft.Json.dll 7 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Net.Http.Formatting.dll 8 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Helpers.dll 9 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Http.dll 10 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Http.WebHost.dll 11 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Mvc.dll 12 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Optimization.dll 13 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Razor.dll 14 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.WebPages.Deployment.dll 15 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.WebPages.dll 16 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.WebPages.Razor.dll 17 | D:\Site\Demo\WebDemo\ApiWeb\bin\WebGrease.dll 18 | D:\Site\Demo\WebDemo\ApiWeb\bin\Newtonsoft.Json.xml 19 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Net.Http.Formatting.xml 20 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Helpers.xml 21 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Http.xml 22 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Http.WebHost.xml 23 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Mvc.xml 24 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Optimization.xml 25 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.Razor.xml 26 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.WebPages.xml 27 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.WebPages.Deployment.xml 28 | D:\Site\Demo\WebDemo\ApiWeb\bin\System.Web.WebPages.Razor.xml 29 | D:\Site\Demo\WebDemo\ApiWeb\bin\Antlr3.Runtime.pdb 30 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Net.Http.Formatting.resources.dll 31 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.Helpers.resources.dll 32 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.Http.resources.dll 33 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.Http.WebHost.resources.dll 34 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.Mvc.resources.dll 35 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.Optimization.resources.dll 36 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.Razor.resources.dll 37 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.WebPages.resources.dll 38 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.WebPages.Deployment.resources.dll 39 | D:\Site\Demo\WebDemo\ApiWeb\bin\zh-Hans\System.Web.WebPages.Razor.resources.dll 40 | D:\Site\Demo\WebDemo\ApiWeb\obj\Debug\ApiWeb.dll 41 | D:\Site\Demo\WebDemo\ApiWeb\obj\Debug\ApiWeb.pdb 42 | -------------------------------------------------------------------------------- /ApiWeb/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/ApiWeb/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /ApiWeb/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/ApiWeb/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /ApiWeb/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/ApiWeb/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /ApiWeb/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/ApiWeb/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /ApiWeb/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /BusinessWeb/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace BusinessWeb 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BusinessWeb/BusinessWeb.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {F6EA030F-F7DB-4DA3-B816-21AE5F585B95} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | BusinessWeb 15 | BusinessWeb 16 | v4.5 17 | true 18 | 19 | 20 | 21 | 22 | SAK 23 | SAK 24 | SAK 25 | SAK 26 | 27 | 28 | true 29 | full 30 | false 31 | bin\ 32 | DEBUG;TRACE 33 | prompt 34 | 4 35 | 36 | 37 | pdbonly 38 | true 39 | bin\ 40 | TRACE 41 | prompt 42 | 4 43 | 44 | 45 | 46 | 47 | False 48 | ..\WebDemo\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | ..\WebDemo\packages\Microsoft.AspNet.Razor.3.0.0\lib\net45\System.Web.Razor.dll 71 | 72 | 73 | ..\WebDemo\packages\Microsoft.AspNet.Webpages.3.0.0\lib\net45\System.Web.Webpages.dll 74 | 75 | 76 | ..\WebDemo\packages\Microsoft.AspNet.Webpages.3.0.0\lib\net45\System.Web.Webpages.Deployment.dll 77 | 78 | 79 | ..\WebDemo\packages\Microsoft.AspNet.Webpages.3.0.0\lib\net45\System.Web.Webpages.Razor.dll 80 | 81 | 82 | ..\WebDemo\packages\Microsoft.AspNet.Webpages.3.0.0\lib\net45\System.Web.Helpers.dll 83 | 84 | 85 | ..\WebDemo\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | Global.asax 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | Web.config 108 | 109 | 110 | Web.config 111 | 112 | 113 | 114 | 115 | 116 | 117 | 10.0 118 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | True 128 | True 129 | 55414 130 | / 131 | http://localhost:55414/ 132 | False 133 | False 134 | 135 | 136 | False 137 | 138 | 139 | 140 | 141 | 148 | -------------------------------------------------------------------------------- /BusinessWeb/BusinessWeb.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | CurrentPage 10 | True 11 | False 12 | False 13 | False 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | True 23 | True 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BusinessWeb/Controllers/BusinessController.cs: -------------------------------------------------------------------------------- 1 | using BusinessWeb.Models; 2 | using Newtonsoft.Json; 3 | using Newtonsoft.Json.Serialization; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Configuration; 7 | using System.IO; 8 | using System.Linq; 9 | using System.Net; 10 | using System.Net.Http; 11 | using System.Text; 12 | using System.Web; 13 | using System.Web.Mvc; 14 | 15 | 16 | namespace BusinessWeb.Controllers 17 | { 18 | /// 19 | /// 接口调用方 20 | /// 21 | public class BusinessController : Controller 22 | { 23 | private static string mykey = "key_zhangsan"; 24 | private static string mysecret = System.Configuration.ConfigurationManager.AppSettings[mykey]; 25 | private static string siteHost = System.Configuration.ConfigurationManager.AppSettings["siteHost"]; 26 | 27 | /// 28 | /// 请求公开接口 29 | /// 30 | /// 31 | public ActionResult RequestNoSecure(int age) 32 | { 33 | string responseString = HttpGet(siteHost + "NoSecure", "age=" + age); 34 | 35 | return Content(responseString); 36 | } 37 | 38 | /// 39 | /// 请求加密接口 40 | /// 41 | /// 42 | public ActionResult RequestSecureBySign(int age) 43 | { 44 | long timeStamp = DateTime.Now.Ticks; 45 | 46 | var param = new SortedDictionary(new AsciiComparer()); 47 | param.Add("age", age.ToString()); 48 | param.Add("appKey", mykey); 49 | param.Add("_timestamp", timeStamp.ToString()); 50 | 51 | 52 | string _sign = SignHelper.GetSign(param, mykey); 53 | 54 | string responseString = HttpGet(siteHost + "SecureBySign", "age=" + age + "&_timestamp=" + timeStamp.ToString() + "&appKey=" + mykey + "&_sign=" + _sign); 55 | 56 | return Content(responseString); 57 | } 58 | 59 | /// 60 | /// 请求加密并根据时间戳判断有效性的接口 61 | /// 62 | /// 63 | public ActionResult RequestSecureBySign_Expired(int age) 64 | { 65 | long timeStamp = DateTime.Now.Ticks; 66 | 67 | var param = new SortedDictionary(new AsciiComparer()); 68 | param.Add("age", age.ToString()); 69 | param.Add("appKey", mykey); 70 | param.Add("_timestamp", timeStamp.ToString()); 71 | 72 | 73 | string _sign = SignHelper.GetSign(param, mykey); 74 | 75 | string responseString = HttpGet(siteHost + "SecureBySign/Expired", "age=" + age + "&_timestamp=" + timeStamp.ToString() + "&appKey=" + mykey + "&_sign=" + _sign); 76 | 77 | return Content(responseString); 78 | } 79 | 80 | /// 81 | /// 请求加密并根据时间戳判断有效性的接口 82 | /// 83 | /// 84 | public ActionResult RequestSecureBySign_Expired_KeySecret(int age) 85 | { 86 | long timeStamp = DateTime.Now.Ticks; 87 | 88 | var param = new SortedDictionary(new AsciiComparer()); 89 | param.Add("age", age.ToString()); 90 | param.Add("appKey", mykey); 91 | param.Add("appSecret", mysecret);//把secret加入进行加密 92 | param.Add("_timestamp", timeStamp.ToString()); 93 | 94 | string _sign = SignHelper.GetSign(param, mykey); 95 | 96 | string responseString = HttpGet(siteHost + "SecureBySign/Expired/KeySecret", "age=" + age + "&_timestamp=" + timeStamp.ToString() + "&appKey=" + mykey + "&_sign=" + _sign); 97 | 98 | return Content(responseString); 99 | } 100 | 101 | 102 | #region 辅助方法 103 | /// 104 | /// 创建返回实例 105 | /// 106 | /// 107 | /// 108 | [HttpPost] 109 | protected ActionResult JsonResult(object obj) 110 | { 111 | var formatter = new JsonSerializerSettings() 112 | { 113 | ContractResolver = new CamelCasePropertyNamesContractResolver() 114 | }; 115 | var content = Newtonsoft.Json.JsonConvert.SerializeObject(obj, Formatting.Indented, formatter); 116 | return Content(content, "application/json", System.Text.UTF8Encoding.UTF8); 117 | } 118 | 119 | 120 | /// 121 | /// body是要传递的参数,格式"roleId=1&uid=2" 122 | /// post的cotentType填写:"application/x-www-form-urlencoded" 123 | /// soap填写:"text/xml; charset=utf-8" 124 | /// 125 | /// 126 | /// 127 | /// 128 | public static string HttpPost(string url, string body) 129 | { 130 | HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); 131 | 132 | httpWebRequest.ContentType = "application/json;charset=UTF-8"; 133 | httpWebRequest.Method = "POST"; 134 | httpWebRequest.Timeout = 20000; 135 | 136 | byte[] btBodys = Encoding.UTF8.GetBytes(body); 137 | httpWebRequest.ContentLength = btBodys.Length; 138 | httpWebRequest.GetRequestStream().Write(btBodys, 0, btBodys.Length); 139 | 140 | HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); 141 | StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream()); 142 | string responseContent = streamReader.ReadToEnd(); 143 | 144 | httpWebResponse.Close(); 145 | streamReader.Close(); 146 | httpWebRequest.Abort(); 147 | httpWebResponse.Close(); 148 | 149 | return responseContent; 150 | } 151 | 152 | 153 | /// 154 | /// get请求 155 | /// 156 | /// 地址 157 | /// 参数:格式"roleId=1&uid=2" 158 | /// 159 | public string HttpGet(string Url, string postDataStr) 160 | { 161 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr); 162 | request.Method = "GET"; 163 | request.ContentType = "text/html;charset=UTF-8"; 164 | 165 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 166 | Stream myResponseStream = response.GetResponseStream(); 167 | StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); 168 | string retString = myStreamReader.ReadToEnd(); 169 | myStreamReader.Close(); 170 | myResponseStream.Close(); 171 | 172 | return retString; 173 | } 174 | #endregion 175 | } 176 | } -------------------------------------------------------------------------------- /BusinessWeb/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="BusinessWeb.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /BusinessWeb/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace BusinessWeb 9 | { 10 | public class MvcApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | AreaRegistration.RegisterAllAreas(); 15 | RouteConfig.RegisterRoutes(RouteTable.Routes); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BusinessWeb/Models/AsciiComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace BusinessWeb.Models 7 | { 8 | /// 9 | /// 基于ASCII码排序规则的String比较器 10 | /// 11 | public class AsciiComparer : System.Collections.Generic.IComparer 12 | { 13 | public int Compare(string a, string b) 14 | { 15 | if (a == b) 16 | return 0; 17 | else if (string.IsNullOrEmpty(a)) 18 | return -1; 19 | else if (string.IsNullOrEmpty(b)) 20 | return 1; 21 | if (a.Length <= b.Length) 22 | { 23 | for (int i = 0; i < a.Length; i++) 24 | { 25 | if (a[i] < b[i]) 26 | return -1; 27 | else if (a[i] > b[i]) 28 | return 1; 29 | else 30 | continue; 31 | } 32 | return a.Length == b.Length ? 0 : -1; 33 | } 34 | else 35 | { 36 | for (int i = 0; i < b.Length; i++) 37 | { 38 | if (a[i] < b[i]) 39 | return -1; 40 | else if (a[i] > b[i]) 41 | return 1; 42 | else 43 | continue; 44 | } 45 | return 1; 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /BusinessWeb/Models/ResultModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace BusinessWeb.Models 7 | { 8 | /// 9 | /// 统一接口Json返回结果格式 10 | /// 11 | /// 12 | public class ResultModel where T : class 13 | { 14 | /// 15 | /// 状态码 16 | /// 17 | public int ReturnCode { get; set; } 18 | 19 | /// 20 | /// 附加消息 21 | /// 22 | public string Message { get; set; } 23 | 24 | /// 25 | /// 附加数据 26 | /// 27 | public T Result { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /BusinessWeb/Models/SignHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | 7 | namespace BusinessWeb.Models 8 | { 9 | public class SignHelper 10 | { 11 | public static string GetSign(SortedDictionary paramList, string appKey = "") 12 | { 13 | paramList.Remove("_sign"); 14 | StringBuilder sb = new StringBuilder(appKey); 15 | foreach (var p in paramList) 16 | sb.Append(p.Key).Append(p.Value); 17 | sb.Append(appKey); 18 | return GetMD5(sb.ToString()); 19 | } 20 | public static string GetMD5(string str) 21 | { 22 | if (string.IsNullOrEmpty(str)) 23 | return str; 24 | var sb = new StringBuilder(32); 25 | var md5 = System.Security.Cryptography.MD5.Create(); 26 | var output = md5.ComputeHash(Encoding.UTF8.GetBytes(str)); 27 | for (int i = 0; i < output.Length; i++) 28 | sb.Append(output[i].ToString("X").PadLeft(2, '0')); 29 | return sb.ToString(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /BusinessWeb/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过下列特性集 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("BusinessWeb")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("BusinessWeb")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要 19 | // 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID 23 | [assembly: Guid("a722a750-91fd-44ad-a703-9b8ef4a8707b")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订版本 31 | // 32 | // 可以指定所有值,也可以使用“修订号”和“内部版本号”的默认值, 33 | // 方法是按如下所示使用 "*": 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /BusinessWeb/Views/web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /BusinessWeb/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 30 | 31 | -------------------------------------------------------------------------------- /BusinessWeb/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 31 | 32 | -------------------------------------------------------------------------------- /BusinessWeb/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /BusinessWeb/bin/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/bin/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /BusinessWeb/bin/System.Web.Helpers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/bin/System.Web.Helpers.dll -------------------------------------------------------------------------------- /BusinessWeb/bin/System.Web.Mvc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/bin/System.Web.Mvc.dll -------------------------------------------------------------------------------- /BusinessWeb/bin/System.Web.Razor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/bin/System.Web.Razor.dll -------------------------------------------------------------------------------- /BusinessWeb/bin/System.Web.Webpages.Deployment.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/bin/System.Web.Webpages.Deployment.dll -------------------------------------------------------------------------------- /BusinessWeb/bin/System.Web.Webpages.Razor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/bin/System.Web.Webpages.Razor.dll -------------------------------------------------------------------------------- /BusinessWeb/bin/System.Web.Webpages.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/bin/System.Web.Webpages.dll -------------------------------------------------------------------------------- /BusinessWeb/obj/Debug/BusinessWeb.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\Site\Demo\BusinessWeb\bin\BusinessWeb.dll.config 2 | D:\Site\Demo\BusinessWeb\bin\BusinessWeb.dll 3 | D:\Site\Demo\BusinessWeb\bin\BusinessWeb.pdb 4 | D:\Site\Demo\BusinessWeb\bin\System.Web.Helpers.dll 5 | D:\Site\Demo\BusinessWeb\bin\System.Web.Mvc.dll 6 | D:\Site\Demo\BusinessWeb\bin\System.Web.Razor.dll 7 | D:\Site\Demo\BusinessWeb\bin\System.Web.Webpages.Deployment.dll 8 | D:\Site\Demo\BusinessWeb\bin\System.Web.Webpages.dll 9 | D:\Site\Demo\BusinessWeb\bin\System.Web.Webpages.Razor.dll 10 | D:\Site\Demo\BusinessWeb\bin\System.Web.Razor.xml 11 | D:\Site\Demo\BusinessWeb\bin\System.Web.Webpages.xml 12 | D:\Site\Demo\BusinessWeb\bin\System.Web.Webpages.Deployment.xml 13 | D:\Site\Demo\BusinessWeb\bin\System.Web.Webpages.Razor.xml 14 | D:\Site\Demo\BusinessWeb\bin\System.Web.Helpers.xml 15 | D:\Site\Demo\BusinessWeb\bin\System.Web.Mvc.xml 16 | D:\Site\Demo\BusinessWeb\bin\zh-Hans\System.Web.Razor.resources.dll 17 | D:\Site\Demo\BusinessWeb\bin\zh-Hans\System.Web.Webpages.resources.dll 18 | D:\Site\Demo\BusinessWeb\bin\zh-Hans\System.Web.Webpages.Deployment.resources.dll 19 | D:\Site\Demo\BusinessWeb\bin\zh-Hans\System.Web.Webpages.Razor.resources.dll 20 | D:\Site\Demo\BusinessWeb\bin\zh-Hans\System.Web.Helpers.resources.dll 21 | D:\Site\Demo\BusinessWeb\bin\zh-Hans\System.Web.Mvc.resources.dll 22 | D:\Site\Demo\BusinessWeb\obj\Debug\BusinessWeb.dll 23 | D:\Site\Demo\BusinessWeb\obj\Debug\BusinessWeb.pdb 24 | D:\Site\Demo\BusinessWeb\bin\Newtonsoft.Json.dll 25 | D:\Site\Demo\BusinessWeb\bin\Newtonsoft.Json.xml 26 | D:\Site\Demo\WebDemo\BusinessWeb\bin\BusinessWeb.dll.config 27 | D:\Site\Demo\WebDemo\BusinessWeb\bin\BusinessWeb.dll 28 | D:\Site\Demo\WebDemo\BusinessWeb\bin\BusinessWeb.pdb 29 | D:\Site\Demo\WebDemo\BusinessWeb\bin\Newtonsoft.Json.dll 30 | D:\Site\Demo\WebDemo\BusinessWeb\obj\Debug\BusinessWeb.dll 31 | D:\Site\Demo\WebDemo\BusinessWeb\obj\Debug\BusinessWeb.pdb 32 | -------------------------------------------------------------------------------- /BusinessWeb/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /BusinessWeb/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /BusinessWeb/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /BusinessWeb/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/BusinessWeb/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /BusinessWeb/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WebDemo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiWeb", "ApiWeb\ApiWeb.csproj", "{6B4B7F2C-1EB0-4852-A956-E14A57154C28}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessWeb", "BusinessWeb\BusinessWeb.csproj", "{F6EA030F-F7DB-4DA3-B816-21AE5F585B95}" 9 | EndProject 10 | Global 11 | GlobalSection(TeamFoundationVersionControl) = preSolution 12 | SccNumberOfProjects = 3 13 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} 14 | SccTeamFoundationServer = https://wenyang0710.visualstudio.com/ 15 | SccLocalPath0 = . 16 | SccProjectUniqueName1 = ApiWeb\\ApiWeb.csproj 17 | SccProjectName1 = ApiWeb 18 | SccLocalPath1 = ApiWeb 19 | SccProjectUniqueName2 = BusinessWeb\\BusinessWeb.csproj 20 | SccProjectName2 = BusinessWeb 21 | SccLocalPath2 = BusinessWeb 22 | EndGlobalSection 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Any CPU = Debug|Any CPU 25 | Release|Any CPU = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 28 | {6B4B7F2C-1EB0-4852-A956-E14A57154C28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {6B4B7F2C-1EB0-4852-A956-E14A57154C28}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {6B4B7F2C-1EB0-4852-A956-E14A57154C28}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {6B4B7F2C-1EB0-4852-A956-E14A57154C28}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {F6EA030F-F7DB-4DA3-B816-21AE5F585B95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {F6EA030F-F7DB-4DA3-B816-21AE5F585B95}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {F6EA030F-F7DB-4DA3-B816-21AE5F585B95}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {F6EA030F-F7DB-4DA3-B816-21AE5F585B95}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | EndGlobal 41 | -------------------------------------------------------------------------------- /packages/Antlr.3.4.1.9004/Antlr.3.4.1.9004.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Antlr.3.4.1.9004/Antlr.3.4.1.9004.nupkg -------------------------------------------------------------------------------- /packages/Antlr.3.4.1.9004/lib/Antlr3.Runtime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Antlr.3.4.1.9004/lib/Antlr3.Runtime.dll -------------------------------------------------------------------------------- /packages/Antlr.3.4.1.9004/lib/Antlr3.Runtime.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Antlr.3.4.1.9004/lib/Antlr3.Runtime.pdb -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Mvc.5.0.0/Microsoft.AspNet.Mvc.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Mvc.5.0.0/Microsoft.AspNet.Mvc.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Mvc.5.0.0/lib/net45/System.Web.Mvc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Mvc.5.0.0/lib/net45/System.Web.Mvc.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Mvc.5.0.0/lib/net45/zh-Hans/System.Web.Mvc.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Mvc.5.0.0/lib/net45/zh-Hans/System.Web.Mvc.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Mvc.zh-Hans.5.0.0/Microsoft.AspNet.Mvc.zh-Hans.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Mvc.zh-Hans.5.0.0/Microsoft.AspNet.Mvc.zh-Hans.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Mvc.zh-Hans.5.0.0/lib/net45/zh-Hans/System.Web.Mvc.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Mvc.zh-Hans.5.0.0/lib/net45/zh-Hans/System.Web.Mvc.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Razor.3.0.0/Microsoft.AspNet.Razor.3.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Razor.3.0.0/Microsoft.AspNet.Razor.3.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Razor.3.0.0/lib/net45/System.Web.Razor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Razor.3.0.0/lib/net45/System.Web.Razor.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Razor.3.0.0/lib/net45/zh-Hans/System.Web.Razor.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Razor.3.0.0/lib/net45/zh-Hans/System.Web.Razor.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Razor.zh-Hans.3.0.0/Microsoft.AspNet.Razor.zh-Hans.3.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Razor.zh-Hans.3.0.0/Microsoft.AspNet.Razor.zh-Hans.3.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Razor.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.Razor.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Razor.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.Razor.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Web.Optimization.1.1.1/Microsoft.AspNet.Web.Optimization.1.1.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Web.Optimization.1.1.1/Microsoft.AspNet.Web.Optimization.1.1.1.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Web.Optimization.1.1.1/lib/net40/System.Web.Optimization.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Web.Optimization.1.1.1/lib/net40/System.Web.Optimization.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Web.Optimization.1.1.1/lib/net40/zh-Hans/System.Web.Optimization.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Web.Optimization.1.1.1/lib/net40/zh-Hans/System.Web.Optimization.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Web.Optimization.zh-Hans.1.1.1/Microsoft.AspNet.Web.Optimization.zh-Hans.1.1.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Web.Optimization.zh-Hans.1.1.1/Microsoft.AspNet.Web.Optimization.zh-Hans.1.1.1.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.Web.Optimization.zh-Hans.1.1.1/lib/net40/zh-Hans/System.Web.Optimization.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.Web.Optimization.zh-Hans.1.1.1/lib/net40/zh-Hans/System.Web.Optimization.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.5.0.0/Microsoft.AspNet.WebApi.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.5.0.0/Microsoft.AspNet.WebApi.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Client.5.0.0/Microsoft.AspNet.WebApi.Client.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Client.5.0.0/Microsoft.AspNet.WebApi.Client.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Client.5.0.0/lib/net45/System.Net.Http.Formatting.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Client.5.0.0/lib/net45/System.Net.Http.Formatting.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Client.5.0.0/lib/net45/zh-Hans/System.Net.Http.Formatting.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Client.5.0.0/lib/net45/zh-Hans/System.Net.Http.Formatting.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Client.5.0.0/lib/portable-wp8%2Bnetcore45%2Bnet45/System.Net.Http.Formatting.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Client.5.0.0/lib/portable-wp8%2Bnetcore45%2Bnet45/System.Net.Http.Formatting.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Client.zh-Hans.5.0.0/Microsoft.AspNet.WebApi.Client.zh-Hans.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Client.zh-Hans.5.0.0/Microsoft.AspNet.WebApi.Client.zh-Hans.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Client.zh-Hans.5.0.0/lib/net45/zh-Hans/System.Net.Http.Formatting.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Client.zh-Hans.5.0.0/lib/net45/zh-Hans/System.Net.Http.Formatting.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Core.5.0.0/Microsoft.AspNet.WebApi.Core.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Core.5.0.0/Microsoft.AspNet.WebApi.Core.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Core.5.0.0/content/web.config.transform: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Core.5.0.0/lib/net45/System.Web.Http.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Core.5.0.0/lib/net45/System.Web.Http.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Core.5.0.0/lib/net45/zh-Hans/System.Web.Http.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Core.5.0.0/lib/net45/zh-Hans/System.Web.Http.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Core.zh-Hans.5.0.0/Microsoft.AspNet.WebApi.Core.zh-Hans.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Core.zh-Hans.5.0.0/Microsoft.AspNet.WebApi.Core.zh-Hans.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.Core.zh-Hans.5.0.0/lib/net45/zh-Hans/System.Web.Http.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.Core.zh-Hans.5.0.0/lib/net45/zh-Hans/System.Web.Http.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/Microsoft.AspNet.WebApi.HelpPage.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/Microsoft.AspNet.WebApi.HelpPage.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/ApiDescriptionExtensions.cs.pp: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Web; 4 | using System.Web.Http.Description; 5 | 6 | namespace $rootnamespace$.Areas.HelpPage 7 | { 8 | public static class ApiDescriptionExtensions 9 | { 10 | /// 11 | /// Generates an URI-friendly ID for the . E.g. "Get-Values-id_name" instead of "GetValues/{id}?name={name}" 12 | /// 13 | /// The . 14 | /// The ID as a string. 15 | public static string GetFriendlyId(this ApiDescription description) 16 | { 17 | string path = description.RelativePath; 18 | string[] urlParts = path.Split('?'); 19 | string localPath = urlParts[0]; 20 | string queryKeyString = null; 21 | if (urlParts.Length > 1) 22 | { 23 | string query = urlParts[1]; 24 | string[] queryKeys = HttpUtility.ParseQueryString(query).AllKeys; 25 | queryKeyString = String.Join("_", queryKeys); 26 | } 27 | 28 | StringBuilder friendlyPath = new StringBuilder(); 29 | friendlyPath.AppendFormat("{0}-{1}", 30 | description.HttpMethod.Method, 31 | localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty)); 32 | if (queryKeyString != null) 33 | { 34 | friendlyPath.AppendFormat("_{0}", queryKeyString); 35 | } 36 | return friendlyPath.ToString(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/App_Start/HelpPageConfig.cs.pp: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http.Headers; 4 | using System.Web; 5 | using System.Web.Http; 6 | 7 | namespace $rootnamespace$.Areas.HelpPage 8 | { 9 | /// 10 | /// Use this class to customize the Help Page. 11 | /// For example you can set a custom to supply the documentation 12 | /// or you can provide the samples for the requests/responses. 13 | /// 14 | public static class HelpPageConfig 15 | { 16 | public static void Register(HttpConfiguration config) 17 | { 18 | //// Uncomment the following to use the documentation from XML documentation file. 19 | //config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml"))); 20 | 21 | //// Uncomment the following to use "sample string" as the sample for all actions that have string as the body parameter or return type. 22 | //// Also, the string arrays will be used for IEnumerable. The sample objects will be serialized into different media type 23 | //// formats by the available formatters. 24 | //config.SetSampleObjects(new Dictionary 25 | //{ 26 | // {typeof(string), "sample string"}, 27 | // {typeof(IEnumerable), new string[]{"sample 1", "sample 2"}} 28 | //}); 29 | 30 | //// Uncomment the following to use "[0]=foo&[1]=bar" directly as the sample for all actions that support form URL encoded format 31 | //// and have IEnumerable as the body parameter or return type. 32 | //config.SetSampleForType("[0]=foo&[1]=bar", new MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(IEnumerable)); 33 | 34 | //// Uncomment the following to use "1234" directly as the request sample for media type "text/plain" on the controller named "Values" 35 | //// and action named "Put". 36 | //config.SetSampleRequest("1234", new MediaTypeHeaderValue("text/plain"), "Values", "Put"); 37 | 38 | //// Uncomment the following to use the image on "../images/aspNetHome.png" directly as the response sample for media type "image/png" 39 | //// on the controller named "Values" and action named "Get" with parameter "id". 40 | //config.SetSampleResponse(new ImageSample("../images/aspNetHome.png"), new MediaTypeHeaderValue("image/png"), "Values", "Get", "id"); 41 | 42 | //// Uncomment the following to correct the sample request when the action expects an HttpRequestMessage with ObjectContent. 43 | //// The sample will be generated as if the controller named "Values" and action named "Get" were having string as the body parameter. 44 | //config.SetActualRequestType(typeof(string), "Values", "Get"); 45 | 46 | //// Uncomment the following to correct the sample response when the action returns an HttpResponseMessage with ObjectContent. 47 | //// The sample will be generated as if the controller named "Values" and action named "Post" were returning a string. 48 | //config.SetActualResponseType(typeof(string), "Values", "Post"); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Controllers/HelpController.cs.pp: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Http; 3 | using System.Web.Mvc; 4 | using $rootnamespace$.Areas.HelpPage.Models; 5 | 6 | namespace $rootnamespace$.Areas.HelpPage.Controllers 7 | { 8 | /// 9 | /// The controller that will handle requests for the help page. 10 | /// 11 | public class HelpController : Controller 12 | { 13 | public HelpController() 14 | : this(GlobalConfiguration.Configuration) 15 | { 16 | } 17 | 18 | public HelpController(HttpConfiguration config) 19 | { 20 | Configuration = config; 21 | } 22 | 23 | public HttpConfiguration Configuration { get; private set; } 24 | 25 | public ActionResult Index() 26 | { 27 | ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider(); 28 | return View(Configuration.Services.GetApiExplorer().ApiDescriptions); 29 | } 30 | 31 | public ActionResult Api(string apiId) 32 | { 33 | if (!String.IsNullOrEmpty(apiId)) 34 | { 35 | HelpPageApiModel apiModel = Configuration.GetHelpPageApiModel(apiId); 36 | if (apiModel != null) 37 | { 38 | return View(apiModel); 39 | } 40 | } 41 | 42 | return View("Error"); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/HelpPage.css.pp: -------------------------------------------------------------------------------- 1 | pre.wrapped { 2 | white-space: -moz-pre-wrap; 3 | white-space: -pre-wrap; 4 | white-space: -o-pre-wrap; 5 | white-space: pre-wrap; 6 | } 7 | 8 | .warning-message-container { 9 | margin-top: 20px; 10 | padding: 0 10px; 11 | color: #525252; 12 | background: #EFDCA9; 13 | border: 1px solid #CCCCCC; 14 | } 15 | 16 | .help-page-table { 17 | width: 100%; 18 | border-collapse: collapse; 19 | text-align: left; 20 | margin: 0px 0px 20px 0px; 21 | border-top: 2px solid #D4D4D4; 22 | } 23 | 24 | .help-page-table th { 25 | text-align: left; 26 | font-weight: bold; 27 | border-bottom: 2px solid #D4D4D4; 28 | padding: 8px 6px 8px 6px; 29 | } 30 | 31 | .help-page-table td { 32 | border-bottom: 2px solid #D4D4D4; 33 | padding: 15px 8px 15px 8px; 34 | vertical-align: top; 35 | } 36 | 37 | .help-page-table pre, .help-page-table p { 38 | margin: 0px; 39 | padding: 0px; 40 | font-family: inherit; 41 | font-size: 100%; 42 | } 43 | 44 | .help-page-table tbody tr:hover td { 45 | background-color: #F3F3F3; 46 | } 47 | 48 | a:hover { 49 | background-color: transparent; 50 | } 51 | 52 | .sample-header { 53 | border: 2px solid #D4D4D4; 54 | background: #76B8DB; 55 | color: #FFFFFF; 56 | padding: 8px 15px; 57 | border-bottom: none; 58 | display: inline-block; 59 | margin: 10px 0px 0px 0px; 60 | } 61 | 62 | .sample-content { 63 | display: block; 64 | border-width: 0; 65 | padding: 15px 20px; 66 | background: #FFFFFF; 67 | border: 2px solid #D4D4D4; 68 | margin: 0px 0px 10px 0px; 69 | } 70 | 71 | .api-name { 72 | width: 40%; 73 | } 74 | 75 | .api-documentation { 76 | width: 60%; 77 | } 78 | 79 | .parameter-name { 80 | width: 20%; 81 | } 82 | 83 | .parameter-documentation { 84 | width: 50%; 85 | } 86 | 87 | .parameter-source { 88 | width: 30%; 89 | } 90 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/HelpPageAreaRegistration.cs.pp: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using System.Web.Mvc; 3 | 4 | namespace $rootnamespace$.Areas.HelpPage 5 | { 6 | public class HelpPageAreaRegistration : AreaRegistration 7 | { 8 | public override string AreaName 9 | { 10 | get 11 | { 12 | return "HelpPage"; 13 | } 14 | } 15 | 16 | public override void RegisterArea(AreaRegistrationContext context) 17 | { 18 | context.MapRoute( 19 | "HelpPage_Default", 20 | "Help/{action}/{apiId}", 21 | new { controller = "Help", action = "Index", apiId = UrlParameter.Optional }); 22 | 23 | HelpPageConfig.Register(GlobalConfiguration.Configuration); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Models/HelpPageApiModel.cs.pp: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.ObjectModel; 3 | using System.Net.Http.Headers; 4 | using System.Web.Http.Description; 5 | 6 | namespace $rootnamespace$.Areas.HelpPage.Models 7 | { 8 | /// 9 | /// The model that represents an API displayed on the help page. 10 | /// 11 | public class HelpPageApiModel 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public HelpPageApiModel() 17 | { 18 | SampleRequests = new Dictionary(); 19 | SampleResponses = new Dictionary(); 20 | ErrorMessages = new Collection(); 21 | } 22 | 23 | /// 24 | /// Gets or sets the that describes the API. 25 | /// 26 | public ApiDescription ApiDescription { get; set; } 27 | 28 | /// 29 | /// Gets the sample requests associated with the API. 30 | /// 31 | public IDictionary SampleRequests { get; private set; } 32 | 33 | /// 34 | /// Gets the sample responses associated with the API. 35 | /// 36 | public IDictionary SampleResponses { get; private set; } 37 | 38 | /// 39 | /// Gets the error messages associated with this model. 40 | /// 41 | public Collection ErrorMessages { get; private set; } 42 | } 43 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/SampleGeneration/HelpPageSampleKey.cs.pp: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Net.Http.Headers; 5 | 6 | namespace $rootnamespace$.Areas.HelpPage 7 | { 8 | /// 9 | /// This is used to identify the place where the sample should be applied. 10 | /// 11 | public class HelpPageSampleKey 12 | { 13 | /// 14 | /// Creates a new based on media type and CLR type. 15 | /// 16 | /// The media type. 17 | /// The CLR type. 18 | public HelpPageSampleKey(MediaTypeHeaderValue mediaType, Type type) 19 | { 20 | if (mediaType == null) 21 | { 22 | throw new ArgumentNullException("mediaType"); 23 | } 24 | if (type == null) 25 | { 26 | throw new ArgumentNullException("type"); 27 | } 28 | ControllerName = String.Empty; 29 | ActionName = String.Empty; 30 | ParameterNames = new HashSet(StringComparer.OrdinalIgnoreCase); 31 | ParameterType = type; 32 | MediaType = mediaType; 33 | } 34 | 35 | /// 36 | /// Creates a new based on , controller name, action name and parameter names. 37 | /// 38 | /// The . 39 | /// Name of the controller. 40 | /// Name of the action. 41 | /// The parameter names. 42 | public HelpPageSampleKey(SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable parameterNames) 43 | { 44 | if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection)) 45 | { 46 | throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection)); 47 | } 48 | if (controllerName == null) 49 | { 50 | throw new ArgumentNullException("controllerName"); 51 | } 52 | if (actionName == null) 53 | { 54 | throw new ArgumentNullException("actionName"); 55 | } 56 | if (parameterNames == null) 57 | { 58 | throw new ArgumentNullException("parameterNames"); 59 | } 60 | ControllerName = controllerName; 61 | ActionName = actionName; 62 | ParameterNames = new HashSet(parameterNames, StringComparer.OrdinalIgnoreCase); 63 | SampleDirection = sampleDirection; 64 | } 65 | 66 | /// 67 | /// Creates a new based on media type, , controller name, action name and parameter names. 68 | /// 69 | /// The media type. 70 | /// The . 71 | /// Name of the controller. 72 | /// Name of the action. 73 | /// The parameter names. 74 | public HelpPageSampleKey(MediaTypeHeaderValue mediaType, SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable parameterNames) 75 | { 76 | if (mediaType == null) 77 | { 78 | throw new ArgumentNullException("mediaType"); 79 | } 80 | if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection)) 81 | { 82 | throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection)); 83 | } 84 | if (controllerName == null) 85 | { 86 | throw new ArgumentNullException("controllerName"); 87 | } 88 | if (actionName == null) 89 | { 90 | throw new ArgumentNullException("actionName"); 91 | } 92 | if (parameterNames == null) 93 | { 94 | throw new ArgumentNullException("parameterNames"); 95 | } 96 | ControllerName = controllerName; 97 | ActionName = actionName; 98 | MediaType = mediaType; 99 | ParameterNames = new HashSet(parameterNames, StringComparer.OrdinalIgnoreCase); 100 | SampleDirection = sampleDirection; 101 | } 102 | 103 | /// 104 | /// Gets the name of the controller. 105 | /// 106 | /// 107 | /// The name of the controller. 108 | /// 109 | public string ControllerName { get; private set; } 110 | 111 | /// 112 | /// Gets the name of the action. 113 | /// 114 | /// 115 | /// The name of the action. 116 | /// 117 | public string ActionName { get; private set; } 118 | 119 | /// 120 | /// Gets the media type. 121 | /// 122 | /// 123 | /// The media type. 124 | /// 125 | public MediaTypeHeaderValue MediaType { get; private set; } 126 | 127 | /// 128 | /// Gets the parameter names. 129 | /// 130 | public HashSet ParameterNames { get; private set; } 131 | 132 | public Type ParameterType { get; private set; } 133 | 134 | /// 135 | /// Gets the . 136 | /// 137 | public SampleDirection? SampleDirection { get; private set; } 138 | 139 | public override bool Equals(object obj) 140 | { 141 | HelpPageSampleKey otherKey = obj as HelpPageSampleKey; 142 | if (otherKey == null) 143 | { 144 | return false; 145 | } 146 | 147 | return String.Equals(ControllerName, otherKey.ControllerName, StringComparison.OrdinalIgnoreCase) && 148 | String.Equals(ActionName, otherKey.ActionName, StringComparison.OrdinalIgnoreCase) && 149 | (MediaType == otherKey.MediaType || (MediaType != null && MediaType.Equals(otherKey.MediaType))) && 150 | ParameterType == otherKey.ParameterType && 151 | SampleDirection == otherKey.SampleDirection && 152 | ParameterNames.SetEquals(otherKey.ParameterNames); 153 | } 154 | 155 | public override int GetHashCode() 156 | { 157 | int hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode(); 158 | if (MediaType != null) 159 | { 160 | hashCode ^= MediaType.GetHashCode(); 161 | } 162 | if (SampleDirection != null) 163 | { 164 | hashCode ^= SampleDirection.GetHashCode(); 165 | } 166 | if (ParameterType != null) 167 | { 168 | hashCode ^= ParameterType.GetHashCode(); 169 | } 170 | foreach (string parameterName in ParameterNames) 171 | { 172 | hashCode ^= parameterName.ToUpperInvariant().GetHashCode(); 173 | } 174 | 175 | return hashCode; 176 | } 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/SampleGeneration/ImageSample.cs.pp: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace $rootnamespace$.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents an image sample on the help page. There's a display template named ImageSample associated with this class. 7 | /// 8 | public class ImageSample 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The URL of an image. 14 | public ImageSample(string src) 15 | { 16 | if (src == null) 17 | { 18 | throw new ArgumentNullException("src"); 19 | } 20 | Src = src; 21 | } 22 | 23 | public string Src { get; private set; } 24 | 25 | public override bool Equals(object obj) 26 | { 27 | ImageSample other = obj as ImageSample; 28 | return other != null && Src == other.Src; 29 | } 30 | 31 | public override int GetHashCode() 32 | { 33 | return Src.GetHashCode(); 34 | } 35 | 36 | public override string ToString() 37 | { 38 | return Src; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/SampleGeneration/InvalidSample.cs.pp: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace $rootnamespace$.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents an invalid sample on the help page. There's a display template named InvalidSample associated with this class. 7 | /// 8 | public class InvalidSample 9 | { 10 | public InvalidSample(string errorMessage) 11 | { 12 | if (errorMessage == null) 13 | { 14 | throw new ArgumentNullException("errorMessage"); 15 | } 16 | ErrorMessage = errorMessage; 17 | } 18 | 19 | public string ErrorMessage { get; private set; } 20 | 21 | public override bool Equals(object obj) 22 | { 23 | InvalidSample other = obj as InvalidSample; 24 | return other != null && ErrorMessage == other.ErrorMessage; 25 | } 26 | 27 | public override int GetHashCode() 28 | { 29 | return ErrorMessage.GetHashCode(); 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return ErrorMessage; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/SampleGeneration/SampleDirection.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Areas.HelpPage 2 | { 3 | /// 4 | /// Indicates whether the sample is used for request or response 5 | /// 6 | public enum SampleDirection 7 | { 8 | Request = 0, 9 | Response 10 | } 11 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/SampleGeneration/TextSample.cs.pp: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace $rootnamespace$.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents a preformatted text sample on the help page. There's a display template named TextSample associated with this class. 7 | /// 8 | public class TextSample 9 | { 10 | public TextSample(string text) 11 | { 12 | if (text == null) 13 | { 14 | throw new ArgumentNullException("text"); 15 | } 16 | Text = text; 17 | } 18 | 19 | public string Text { get; private set; } 20 | 21 | public override bool Equals(object obj) 22 | { 23 | TextSample other = obj as TextSample; 24 | return other != null && Text == other.Text; 25 | } 26 | 27 | public override int GetHashCode() 28 | { 29 | return Text.GetHashCode(); 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return Text; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/Api.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using $rootnamespace$.Areas.HelpPage.Models 3 | @model HelpPageApiModel 4 | 5 | @{ 6 | var description = Model.ApiDescription; 7 | ViewBag.Title = description.HttpMethod.Method + " " + description.RelativePath; 8 | } 9 | 10 |
11 | 18 |
19 | @Html.DisplayFor(m => Model) 20 |
21 |
22 | 23 | @section Scripts { 24 | 25 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using System.Web.Http.Controllers 3 | @using System.Web.Http.Description 4 | @using $rootnamespace$.Areas.HelpPage 5 | @using $rootnamespace$.Areas.HelpPage.Models 6 | @model IGrouping 7 | 8 | @{ 9 | var controllerDocumentation = ViewBag.DocumentationProvider != null ? 10 | ViewBag.DocumentationProvider.GetDocumentation(Model.Key) : 11 | null; 12 | } 13 | 14 |

@Model.Key.ControllerName

15 | @if (!String.IsNullOrEmpty(controllerDocumentation)) 16 | { 17 |

@controllerDocumentation

18 | } 19 | 20 | 21 | 22 | 23 | 24 | @foreach (var api in Model) 25 | { 26 | 27 | 28 | 38 | 39 | } 40 | 41 |
APIDescription
@api.HttpMethod.Method @api.RelativePath 29 | @if (api.Documentation != null) 30 | { 31 |

@api.Documentation

32 | } 33 | else 34 | { 35 |

No documentation available.

36 | } 37 |
-------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/DisplayTemplates/HelpPageApiModel.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using $rootnamespace$.Areas.HelpPage.Models 3 | @model HelpPageApiModel 4 | 5 | @{ 6 | var description = Model.ApiDescription; 7 | bool hasParameters = description.ParameterDescriptions.Count > 0; 8 | bool hasRequestSamples = Model.SampleRequests.Count > 0; 9 | bool hasResponseSamples = Model.SampleResponses.Count > 0; 10 | } 11 |

@description.HttpMethod.Method @description.RelativePath

12 |
13 | @if (description.Documentation != null) 14 | { 15 |

@description.Documentation

16 | } 17 | else 18 | { 19 |

No documentation available.

20 | } 21 | 22 | @if (hasParameters || hasRequestSamples) 23 | { 24 |

Request Information

25 | if (hasParameters) 26 | { 27 |

Parameters

28 | @Html.DisplayFor(apiModel => apiModel.ApiDescription.ParameterDescriptions, "Parameters") 29 | } 30 | if (hasRequestSamples) 31 | { 32 |

Request body formats

33 | @Html.DisplayFor(apiModel => apiModel.SampleRequests, "Samples") 34 | } 35 | } 36 | 37 | @if (hasResponseSamples) 38 | { 39 |

Response Information

40 | if (description.ResponseDescription.Documentation != null) 41 | { 42 |

@description.ResponseDescription.Documentation

43 | } 44 | else 45 | { 46 |

No documentation available.

47 | } 48 |

Response body formats

49 | @Html.DisplayFor(apiModel => apiModel.SampleResponses, "Samples") 50 | } 51 |
-------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/DisplayTemplates/ImageSample.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Areas.HelpPage 2 | @model ImageSample 3 | 4 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/DisplayTemplates/InvalidSample.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Areas.HelpPage 2 | @model InvalidSample 3 | 4 | @if (HttpContext.Current.IsDebuggingEnabled) 5 | { 6 |
7 |

@Model.ErrorMessage

8 |
9 | } 10 | else 11 | { 12 |

Sample not available.

13 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/DisplayTemplates/Parameters.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using System.Collections.ObjectModel 2 | @using System.Web.Http.Description 3 | @using System.Threading 4 | @model Collection 5 | 6 | 7 | 8 | 9 | 10 | 11 | @foreach (ApiParameterDescription parameter in Model) 12 | { 13 | string parameterDocumentation = parameter.Documentation != null ? 14 | parameter.Documentation : 15 | "No documentation available."; 16 | 17 | // Don't show CancellationToken because it's a special parameter 18 | if (parameter.ParameterDescriptor == null || 19 | (parameter.ParameterDescriptor != null && 20 | !typeof(CancellationToken).IsAssignableFrom(parameter.ParameterDescriptor.ParameterType))) 21 | { 22 | 23 | 24 | 25 | 40 | 41 | } 42 | } 43 | 44 |
NameDescriptionAdditional information
@parameter.Name
@parameterDocumentation
26 | @switch (parameter.Source) 27 | { 28 | case ApiParameterSource.FromBody: 29 |

Define this parameter in the request body.

30 | break; 31 | case ApiParameterSource.FromUri: 32 |

Define this parameter in the request URI.

33 | break; 34 | case ApiParameterSource.Unknown: 35 | default: 36 |

None.

37 | break; 38 | } 39 |
-------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/DisplayTemplates/Samples.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using System.Net.Http.Headers 2 | @model Dictionary 3 | 4 | @{ 5 | // Group the samples into a single tab if they are the same. 6 | Dictionary samples = Model.GroupBy(pair => pair.Value).ToDictionary( 7 | pair => String.Join(", ", pair.Select(m => m.Key.ToString()).ToArray()), 8 | pair => pair.Key); 9 | var mediaTypes = samples.Keys; 10 | } 11 |
12 | @foreach (var mediaType in mediaTypes) 13 | { 14 |

@mediaType

15 |
16 | Sample: 17 | @{ 18 | var sample = samples[mediaType]; 19 | if (sample == null) 20 | { 21 |

Sample not available.

22 | } 23 | else 24 | { 25 | @Html.DisplayFor(s => sample); 26 | } 27 | } 28 |
29 | } 30 |
-------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/DisplayTemplates/TextSample.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Areas.HelpPage 2 | @model TextSample 3 | 4 |
5 | @Model.Text
6 | 
-------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Help/Index.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using System.Web.Http.Controllers 3 | @using System.Web.Http.Description 4 | @using System.Collections.ObjectModel 5 | @using $rootnamespace$.Areas.HelpPage.Models 6 | @model Collection 7 | 8 | @{ 9 | ViewBag.Title = "ASP.NET Web API Help Page"; 10 | 11 | // Group APIs by controller 12 | ILookup apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor); 13 | } 14 | 15 |
16 |
17 |
18 |

@ViewBag.Title

19 |
20 |
21 |
22 |
23 | 31 |
32 | @foreach (var group in apiGroups) 33 | { 34 | @Html.DisplayFor(m => group, "ApiGroup") 35 | } 36 |
37 |
38 | 39 | @section Scripts { 40 | 41 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Shared/_Layout.cshtml.pp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @ViewBag.Title 7 | @RenderSection("scripts", required: false) 8 | 9 | 10 | @RenderBody() 11 | 12 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 43 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/Views/_ViewStart.cshtml.pp: -------------------------------------------------------------------------------- 1 | @{ 2 | // Change the Layout path below to blend the look and feel of the help page with your existing web pages. 3 | Layout = "~/Areas/HelpPage/Views/Shared/_Layout.cshtml"; 4 | } -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.HelpPage.5.0.0/content/Areas/HelpPage/XmlDocumentationProvider.cs.pp: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Web.Http.Controllers; 6 | using System.Web.Http.Description; 7 | using System.Xml.XPath; 8 | 9 | namespace $rootnamespace$.Areas.HelpPage 10 | { 11 | /// 12 | /// A custom that reads the API documentation from an XML documentation file. 13 | /// 14 | public class XmlDocumentationProvider : IDocumentationProvider 15 | { 16 | private XPathNavigator _documentNavigator; 17 | private const string TypeExpression = "/doc/members/member[@name='T:{0}']"; 18 | private const string MethodExpression = "/doc/members/member[@name='M:{0}']"; 19 | private const string ParameterExpression = "param[@name='{0}']"; 20 | 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The physical path to XML document. 25 | public XmlDocumentationProvider(string documentPath) 26 | { 27 | if (documentPath == null) 28 | { 29 | throw new ArgumentNullException("documentPath"); 30 | } 31 | XPathDocument xpath = new XPathDocument(documentPath); 32 | _documentNavigator = xpath.CreateNavigator(); 33 | } 34 | 35 | public string GetDocumentation(HttpControllerDescriptor controllerDescriptor) 36 | { 37 | XPathNavigator typeNode = GetTypeNode(controllerDescriptor); 38 | return GetTagValue(typeNode, "summary"); 39 | } 40 | 41 | public virtual string GetDocumentation(HttpActionDescriptor actionDescriptor) 42 | { 43 | XPathNavigator methodNode = GetMethodNode(actionDescriptor); 44 | return GetTagValue(methodNode, "summary"); 45 | } 46 | 47 | public virtual string GetDocumentation(HttpParameterDescriptor parameterDescriptor) 48 | { 49 | ReflectedHttpParameterDescriptor reflectedParameterDescriptor = parameterDescriptor as ReflectedHttpParameterDescriptor; 50 | if (reflectedParameterDescriptor != null) 51 | { 52 | XPathNavigator methodNode = GetMethodNode(reflectedParameterDescriptor.ActionDescriptor); 53 | if (methodNode != null) 54 | { 55 | string parameterName = reflectedParameterDescriptor.ParameterInfo.Name; 56 | XPathNavigator parameterNode = methodNode.SelectSingleNode(String.Format(CultureInfo.InvariantCulture, ParameterExpression, parameterName)); 57 | if (parameterNode != null) 58 | { 59 | return parameterNode.Value.Trim(); 60 | } 61 | } 62 | } 63 | 64 | return null; 65 | } 66 | 67 | public string GetResponseDocumentation(HttpActionDescriptor actionDescriptor) 68 | { 69 | XPathNavigator methodNode = GetMethodNode(actionDescriptor); 70 | return GetTagValue(methodNode, "returns"); 71 | } 72 | 73 | private XPathNavigator GetMethodNode(HttpActionDescriptor actionDescriptor) 74 | { 75 | ReflectedHttpActionDescriptor reflectedActionDescriptor = actionDescriptor as ReflectedHttpActionDescriptor; 76 | if (reflectedActionDescriptor != null) 77 | { 78 | string selectExpression = String.Format(CultureInfo.InvariantCulture, MethodExpression, GetMemberName(reflectedActionDescriptor.MethodInfo)); 79 | return _documentNavigator.SelectSingleNode(selectExpression); 80 | } 81 | 82 | return null; 83 | } 84 | 85 | private static string GetMemberName(MethodInfo method) 86 | { 87 | string name = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", method.DeclaringType.FullName, method.Name); 88 | ParameterInfo[] parameters = method.GetParameters(); 89 | if (parameters.Length != 0) 90 | { 91 | string[] parameterTypeNames = parameters.Select(param => GetTypeName(param.ParameterType)).ToArray(); 92 | name += String.Format(CultureInfo.InvariantCulture, "({0})", String.Join(",", parameterTypeNames)); 93 | } 94 | 95 | return name; 96 | } 97 | 98 | private static string GetTagValue(XPathNavigator parentNode, string tagName) 99 | { 100 | if (parentNode != null) 101 | { 102 | XPathNavigator node = parentNode.SelectSingleNode(tagName); 103 | if (node != null) 104 | { 105 | return node.Value.Trim(); 106 | } 107 | } 108 | 109 | return null; 110 | } 111 | 112 | private static string GetTypeName(Type type) 113 | { 114 | if (type.IsGenericType) 115 | { 116 | // Format the generic type name to something like: Generic{System.Int32,System.String} 117 | Type genericType = type.GetGenericTypeDefinition(); 118 | Type[] genericArguments = type.GetGenericArguments(); 119 | string typeName = genericType.FullName; 120 | 121 | // Trim the generic parameter counts from the name 122 | typeName = typeName.Substring(0, typeName.IndexOf('`')); 123 | string[] argumentTypeNames = genericArguments.Select(t => GetTypeName(t)).ToArray(); 124 | return String.Format(CultureInfo.InvariantCulture, "{0}{{{1}}}", typeName, String.Join(",", argumentTypeNames)); 125 | } 126 | 127 | return type.FullName; 128 | } 129 | 130 | private XPathNavigator GetTypeNode(HttpControllerDescriptor controllerDescriptor) 131 | { 132 | Type controllerType = controllerDescriptor.ControllerType; 133 | string controllerTypeName = controllerType.FullName; 134 | if (controllerType.IsNested) 135 | { 136 | // Changing the nested type name from OuterType+InnerType to OuterType.InnerType to match the XML documentation syntax. 137 | controllerTypeName = controllerTypeName.Replace("+", "."); 138 | } 139 | string selectExpression = String.Format(CultureInfo.InvariantCulture, TypeExpression, controllerTypeName); 140 | return _documentNavigator.SelectSingleNode(selectExpression); 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.WebHost.5.0.0/Microsoft.AspNet.WebApi.WebHost.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.WebHost.5.0.0/Microsoft.AspNet.WebApi.WebHost.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.WebHost.5.0.0/lib/net45/System.Web.Http.WebHost.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.WebHost.5.0.0/lib/net45/System.Web.Http.WebHost.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.WebHost.5.0.0/lib/net45/zh-Hans/System.Web.Http.WebHost.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.WebHost.5.0.0/lib/net45/zh-Hans/System.Web.Http.WebHost.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.WebHost.zh-Hans.5.0.0/Microsoft.AspNet.WebApi.WebHost.zh-Hans.5.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.WebHost.zh-Hans.5.0.0/Microsoft.AspNet.WebApi.WebHost.zh-Hans.5.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebApi.WebHost.zh-Hans.5.0.0/lib/net45/zh-Hans/System.Web.Http.WebHost.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebApi.WebHost.zh-Hans.5.0.0/lib/net45/zh-Hans/System.Web.Http.WebHost.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/Microsoft.AspNet.WebPages.3.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/Microsoft.AspNet.WebPages.3.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.Helpers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.Helpers.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.WebPages.Deployment.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.WebPages.Deployment.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.WebPages.Deployment.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.WebPages.Deployment 5 | 6 | 7 | 8 | Provides a registration point for pre-application start code for Web Pages deployment. 9 | 10 | 11 | Registers pre-application start code for Web Pages deployment. 12 | 13 | 14 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Provides methods that are used to get deployment information about the Web application. 15 | 16 | 17 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the assembly path for the Web Pages deployment. 18 | The assembly path for the Web Pages deployment. 19 | The Web Pages version. 20 | 21 | 22 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the Web Pages version from the given binary path. 23 | The Web Pages version. 24 | The binary path for the Web Pages. 25 | 26 | 27 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the assembly references from the given path regardless of the Web Pages version. 28 | The dictionary containing the assembly references of the Web Pages and its version. 29 | The path to the Web Pages application. 30 | 31 | 32 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the maximum version of the Web Pages loaded assemblies. 33 | The maximum version of the Web Pages loaded assemblies. 34 | 35 | 36 | Gets the Web Pages version from the given path. 37 | The Web Pages version. 38 | The path of the root directory for the application. 39 | 40 | 41 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the Web Pages version using the configuration settings with the specified path. 42 | The Web Pages version. 43 | The path to the application settings. 44 | 45 | 46 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Returns the assemblies for this Web Pages deployment. 47 | A list containing the assemblies for this Web Pages deployment. 48 | 49 | 50 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Indicates whether the Web Pages deployment is enabled. 51 | true if the Web Pages deployment is enabled; otherwise, false. 52 | The path to the Web Pages deployment. 53 | 54 | 55 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Indicates whether the Web Pages deployment is explicitly disabled. 56 | true if the Web Pages deployment is explicitly disabled; otherwise, false. 57 | The path to the Web Pages deployment. 58 | 59 | 60 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.WebPages.Razor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.WebPages.Razor.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.WebPages.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/System.Web.WebPages.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/System.Web.Helpers.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/System.Web.Helpers.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.Deployment.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.Deployment.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.Razor.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.Razor.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.3.0.0/lib/net45/zh-Hans/system.web.webpages.deployment.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.WebPages.Deployment 5 | 6 | 7 | 8 | 为 Web Pages 部署应用程序预启动代码提供注册点。 9 | 10 | 11 | 注册 Web Pages 部署应用程序预启动代码。 12 | 13 | 14 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 15 | 16 | 17 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 18 | 19 | 20 | 21 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 22 | 23 | 24 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 25 | 26 | 27 | 应用程序根目录的路径。 28 | 29 | 30 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 31 | 32 | 33 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 34 | 35 | 36 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 37 | 38 | 39 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 40 | 41 | 42 | -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/Microsoft.AspNet.WebPages.zh-Hans.3.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/Microsoft.AspNet.WebPages.zh-Hans.3.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.Helpers.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.Helpers.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.Deployment.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.Deployment.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.Razor.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.Razor.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.resources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/System.Web.WebPages.resources.dll -------------------------------------------------------------------------------- /packages/Microsoft.AspNet.WebPages.zh-Hans.3.0.0/lib/net45/zh-Hans/system.web.webpages.deployment.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.WebPages.Deployment 5 | 6 | 7 | 8 | 为 Web Pages 部署应用程序预启动代码提供注册点。 9 | 10 | 11 | 注册 Web Pages 部署应用程序预启动代码。 12 | 13 | 14 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 15 | 16 | 17 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 18 | 19 | 20 | 21 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 22 | 23 | 24 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 25 | 26 | 27 | 应用程序根目录的路径。 28 | 29 | 30 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 31 | 32 | 33 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 34 | 35 | 36 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 37 | 38 | 39 | 此类型/成员支持 .NET Framework 基础结构,不能在代码中直接使用。 40 | 41 | 42 | -------------------------------------------------------------------------------- /packages/Microsoft.Web.Infrastructure.1.0.0.0/Microsoft.Web.Infrastructure.1.0.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.Web.Infrastructure.1.0.0.0/Microsoft.Web.Infrastructure.1.0.0.0.nupkg -------------------------------------------------------------------------------- /packages/Microsoft.Web.Infrastructure.1.0.0.0/Microsoft.Web.Infrastructure.1.0.0.0.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0.0.0 5 | Microsoft 6 | Microsoft 7 | http://go.microsoft.com/fwlink/?LinkID=214339 8 | http://www.asp.net 9 | Microsoft.Web.Infrastructure 10 | Microsoft.Web.Infrastructure 11 | false 12 | This package contains the Microsoft.Web.Infrastructure assembly that lets you dynamically register HTTP modules at run time. 13 | en-US 14 | 15 | -------------------------------------------------------------------------------- /packages/Microsoft.Web.Infrastructure.1.0.0.0/lib/net40/Microsoft.Web.Infrastructure.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Microsoft.Web.Infrastructure.1.0.0.0/lib/net40/Microsoft.Web.Infrastructure.dll -------------------------------------------------------------------------------- /packages/Modernizr.2.6.2/Modernizr.2.6.2.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Modernizr.2.6.2/Modernizr.2.6.2.nupkg -------------------------------------------------------------------------------- /packages/Modernizr.2.6.2/Tools/common.ps1: -------------------------------------------------------------------------------- 1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) { 2 | try { 3 | $referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js") 4 | } 5 | catch { 6 | # _references.js file not found 7 | return 8 | } 9 | 10 | if ($referencesFileProjectItem -eq $null) { 11 | # _references.js file not found 12 | return 13 | } 14 | 15 | $referencesFilePath = $referencesFileProjectItem.FileNames(1) 16 | $referencesTempFilePath = Join-Path $env:TEMP "_references.tmp.js" 17 | 18 | if ((Select-String $referencesFilePath -pattern $fileNamePattern).Length -eq 0) { 19 | # File has no existing matching reference line 20 | # Add the full reference line to the beginning of the file 21 | "/// " | Add-Content $referencesTempFilePath -Encoding UTF8 22 | Get-Content $referencesFilePath | Add-Content $referencesTempFilePath 23 | } 24 | else { 25 | # Loop through file and replace old file name with new file name 26 | Get-Content $referencesFilePath | ForEach-Object { $_ -replace $fileNamePattern, $newFileName } > $referencesTempFilePath 27 | } 28 | 29 | # Copy over the new _references.js file 30 | Copy-Item $referencesTempFilePath $referencesFilePath -Force 31 | Remove-Item $referencesTempFilePath -Force 32 | } 33 | 34 | function Remove-Reference($scriptsFolderProjectItem, $fileNamePattern) { 35 | try { 36 | $referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js") 37 | } 38 | catch { 39 | # _references.js file not found 40 | return 41 | } 42 | 43 | if ($referencesFileProjectItem -eq $null) { 44 | return 45 | } 46 | 47 | $referencesFilePath = $referencesFileProjectItem.FileNames(1) 48 | $referencesTempFilePath = Join-Path $env:TEMP "_references.tmp.js" 49 | 50 | if ((Select-String $referencesFilePath -pattern $fileNamePattern).Length -eq 1) { 51 | # Delete the line referencing the file 52 | Get-Content $referencesFilePath | ForEach-Object { if (-not ($_ -match $fileNamePattern)) { $_ } } > $referencesTempFilePath 53 | 54 | # Copy over the new _references.js file 55 | Copy-Item $referencesTempFilePath $referencesFilePath -Force 56 | Remove-Item $referencesTempFilePath -Force 57 | } 58 | } 59 | 60 | # Extract the version number from the file in the package's content\scripts folder 61 | $packageScriptsFolder = Join-Path $installPath Content\Scripts 62 | $modernizrFileName = Join-Path $packageScriptsFolder "modernizr-*.js" | Get-ChildItem -Exclude "*.min.js","*-vsdoc.js" | Split-Path -Leaf 63 | $modernizrFileNameRegEx = "modernizr-((?:\d+\.)?(?:\d+\.)?(?:\d+\.)?(?:\d+)).js" 64 | $modernizrFileName -match $modernizrFileNameRegEx 65 | $ver = $matches[1] 66 | 67 | # Get the project item for the scripts folder 68 | try { 69 | $scriptsFolderProjectItem = $project.ProjectItems.Item("Scripts") 70 | $projectScriptsFolderPath = $scriptsFolderProjectItem.FileNames(1) 71 | } 72 | catch { 73 | # No Scripts folder 74 | Write-Host "No scripts folder found" 75 | } -------------------------------------------------------------------------------- /packages/Modernizr.2.6.2/Tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | . (Join-Path $toolsPath common.ps1) 4 | 5 | if ($scriptsFolderProjectItem -eq $null) { 6 | # No Scripts folder 7 | Write-Host "No Scripts folder found" 8 | exit 9 | } 10 | 11 | # Update the _references.js file 12 | AddOrUpdate-Reference $scriptsFolderProjectItem $modernizrFileNameRegEx $modernizrFileName -------------------------------------------------------------------------------- /packages/Modernizr.2.6.2/Tools/uninstall.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | . (Join-Path $toolsPath common.ps1) 4 | 5 | # Update the _references.js file 6 | Remove-Reference $scriptsFolderProjectItem $modernizrFileNameRegEx -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.6/Newtonsoft.Json.5.0.6.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Newtonsoft.Json.5.0.6/Newtonsoft.Json.5.0.6.nupkg -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.6/lib/net20/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Newtonsoft.Json.5.0.6/lib/net20/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.6/lib/net35/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Newtonsoft.Json.5.0.6/lib/net35/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.6/lib/net40/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Newtonsoft.Json.5.0.6/lib/net40/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.6/lib/net45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Newtonsoft.Json.5.0.6/lib/net45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.6/lib/netcore45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Newtonsoft.Json.5.0.6/lib/netcore45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.6/lib/portable-net40%2Bsl4%2Bwp7%2Bwin8/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Newtonsoft.Json.5.0.6/lib/portable-net40%2Bsl4%2Bwp7%2Bwin8/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.6/lib/portable-net45%2Bwp80%2Bwin8/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Newtonsoft.Json.5.0.6/lib/portable-net45%2Bwp80%2Bwin8/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Respond.1.2.0/Respond.1.2.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/Respond.1.2.0/Respond.1.2.0.nupkg -------------------------------------------------------------------------------- /packages/Respond.1.2.0/content/Scripts/respond.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 16 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 17 | window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='­';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); 18 | 19 | /*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 20 | (function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this); -------------------------------------------------------------------------------- /packages/WebGrease.1.5.2/WebGrease.1.5.2.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/WebGrease.1.5.2/WebGrease.1.5.2.nupkg -------------------------------------------------------------------------------- /packages/WebGrease.1.5.2/lib/WebGrease.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/WebGrease.1.5.2/lib/WebGrease.dll -------------------------------------------------------------------------------- /packages/WebGrease.1.5.2/tools/WG.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/WebGrease.1.5.2/tools/WG.exe -------------------------------------------------------------------------------- /packages/bootstrap.3.0.0/bootstrap.3.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/bootstrap.3.0.0/bootstrap.3.0.0.nupkg -------------------------------------------------------------------------------- /packages/bootstrap.3.0.0/content/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/bootstrap.3.0.0/content/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /packages/bootstrap.3.0.0/content/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/bootstrap.3.0.0/content/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /packages/bootstrap.3.0.0/content/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/bootstrap.3.0.0/content/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /packages/jQuery.1.10.2/Tools/common.ps1: -------------------------------------------------------------------------------- 1 | function Get-Checksum($file) { 2 | $cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider" 3 | 4 | $fileInfo = Get-Item $file 5 | trap { ; 6 | continue } $stream = $fileInfo.OpenRead() 7 | if ($? -eq $false) { 8 | # Couldn't open file for reading 9 | return $null 10 | } 11 | 12 | $bytes = $cryptoProvider.ComputeHash($stream) 13 | $checksum = '' 14 | foreach ($byte in $bytes) { 15 | $checksum += $byte.ToString('x2') 16 | } 17 | 18 | $stream.Close() | Out-Null 19 | 20 | return $checksum 21 | } 22 | 23 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) { 24 | try { 25 | $referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js") 26 | } 27 | catch { 28 | # _references.js file not found 29 | return 30 | } 31 | 32 | if ($referencesFileProjectItem -eq $null) { 33 | # _references.js file not found 34 | return 35 | } 36 | 37 | $referencesFilePath = $referencesFileProjectItem.FileNames(1) 38 | $referencesTempFilePath = Join-Path $env:TEMP "_references.tmp.js" 39 | 40 | if ((Select-String $referencesFilePath -pattern $fileNamePattern).Length -eq 0) { 41 | # File has no existing matching reference line 42 | # Add the full reference line to the beginning of the file 43 | "/// " | Add-Content $referencesTempFilePath -Encoding UTF8 44 | Get-Content $referencesFilePath | Add-Content $referencesTempFilePath 45 | } 46 | else { 47 | # Loop through file and replace old file name with new file name 48 | Get-Content $referencesFilePath | ForEach-Object { $_ -replace $fileNamePattern, $newFileName } > $referencesTempFilePath 49 | } 50 | 51 | # Copy over the new _references.js file 52 | Copy-Item $referencesTempFilePath $referencesFilePath -Force 53 | Remove-Item $referencesTempFilePath -Force 54 | } 55 | 56 | function Remove-Reference($scriptsFolderProjectItem, $fileNamePattern) { 57 | try { 58 | $referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js") 59 | } 60 | catch { 61 | # _references.js file not found 62 | return 63 | } 64 | 65 | if ($referencesFileProjectItem -eq $null) { 66 | return 67 | } 68 | 69 | $referencesFilePath = $referencesFileProjectItem.FileNames(1) 70 | $referencesTempFilePath = Join-Path $env:TEMP "_references.tmp.js" 71 | 72 | if ((Select-String $referencesFilePath -pattern $fileNamePattern).Length -eq 1) { 73 | # Delete the line referencing the file 74 | Get-Content $referencesFilePath | ForEach-Object { if (-not ($_ -match $fileNamePattern)) { $_ } } > $referencesTempFilePath 75 | 76 | # Copy over the new _references.js file 77 | Copy-Item $referencesTempFilePath $referencesFilePath -Force 78 | Remove-Item $referencesTempFilePath -Force 79 | } 80 | } 81 | 82 | function Delete-ProjectItem($item) { 83 | $itemDeleted = $false 84 | for ($1=1; $i -le 5; $i++) { 85 | try { 86 | $item.Delete() 87 | $itemDeleted = $true 88 | break 89 | } 90 | catch { 91 | # Try again in 200ms 92 | [System.Threading.Thread]::Sleep(200) 93 | } 94 | } 95 | if ($itemDeleted -eq $false) { 96 | throw "Unable to delete project item after five attempts." 97 | } 98 | } 99 | 100 | # Extract the version number from the jquery file in the package's content\scripts folder 101 | $packageScriptsFolder = Join-Path $installPath Content\Scripts 102 | $jqueryFileName = Join-Path $packageScriptsFolder "jquery-*.js" | Get-ChildItem -Exclude "*.min.js","*-vsdoc.js" | Split-Path -Leaf 103 | $jqueryFileNameRegEx = "jquery-((?:\d+\.)?(?:\d+\.)?(?:\d+\.)?(?:\d+)).js" 104 | $jqueryFileName -match $jqueryFileNameRegEx 105 | $ver = $matches[1] 106 | 107 | $intelliSenseFileName = "jquery-$ver.intellisense.js" 108 | 109 | # Get the project item for the scripts folder 110 | try { 111 | $scriptsFolderProjectItem = $project.ProjectItems.Item("Scripts") 112 | $projectScriptsFolderPath = $scriptsFolderProjectItem.FileNames(1) 113 | } 114 | catch { 115 | # No Scripts folder 116 | Write-Host "No scripts folder found" 117 | } -------------------------------------------------------------------------------- /packages/jQuery.1.10.2/Tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | . (Join-Path $toolsPath common.ps1) 4 | 5 | # VS 11 and above supports the new intellisense JS files 6 | $vsVersion = [System.Version]::Parse($dte.Version) 7 | $supportsJsIntelliSenseFile = $vsVersion.Major -ge 11 8 | 9 | if (-not $supportsJsIntelliSenseFile) { 10 | $displayVersion = $vsVersion.Major 11 | Write-Host "IntelliSense JS files are not supported by your version of Visual Studio: $displayVersion" 12 | exit 13 | } 14 | 15 | if ($scriptsFolderProjectItem -eq $null) { 16 | # No Scripts folder 17 | Write-Host "No Scripts folder found" 18 | exit 19 | } 20 | 21 | # Delete the vsdoc file from the project 22 | try { 23 | $vsDocProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("jquery-$ver-vsdoc.js") 24 | Delete-ProjectItem $vsDocProjectItem 25 | } 26 | catch { 27 | Write-Host "Error deleting vsdoc file: " + $_.Exception -ForegroundColor Red 28 | exit 29 | } 30 | 31 | # Copy the intellisense file to the project from the tools folder 32 | $intelliSenseFileSourcePath = Join-Path $toolsPath $intelliSenseFileName 33 | try { 34 | $scriptsFolderProjectItem.ProjectItems.AddFromFileCopy($intelliSenseFileSourcePath) 35 | } 36 | catch { 37 | # This will throw if the file already exists, so we need to catch here 38 | } 39 | 40 | # Update the _references.js file 41 | AddOrUpdate-Reference $scriptsFolderProjectItem $jqueryFileNameRegEx $jqueryFileName -------------------------------------------------------------------------------- /packages/jQuery.1.10.2/Tools/uninstall.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | . (Join-Path $toolsPath common.ps1) 4 | 5 | # Determine the file paths 6 | $projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName 7 | $origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName 8 | 9 | if (Test-Path $projectIntelliSenseFilePath) { 10 | if ((Get-Checksum $projectIntelliSenseFilePath) -eq (Get-Checksum $origIntelliSenseFilePath)) { 11 | # The intellisense file in the project matches the file in the tools folder, delete it 12 | 13 | if ($scriptsFolderProjectItem -eq $null) { 14 | # No Scripts folder 15 | exit 16 | } 17 | 18 | try { 19 | # Get the project item for the intellisense file 20 | $intelliSenseFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item($intelliSenseFileName) 21 | } 22 | catch { 23 | # The item wasn't found 24 | exit 25 | } 26 | 27 | # Delete the project item 28 | Delete-ProjectItem $intelliSenseFileProjectItem 29 | } 30 | else { 31 | $projectScriptsFolderLeaf = Split-Path $projectScriptsFolderPath -Leaf 32 | Write-Host "Skipping '$projectScriptsFolderLeaf\$intelliSenseFileName' because it was modified." -ForegroundColor Magenta 33 | } 34 | } 35 | else { 36 | # The intellisense file was not found in project 37 | Write-Host "The intellisense file was not found in project at path $projectIntelliSenseFilePath" 38 | } 39 | 40 | # Update the _references.js file 41 | Remove-Reference $scriptsFolderProjectItem $jqueryFileNameRegEx -------------------------------------------------------------------------------- /packages/jQuery.1.10.2/jQuery.1.10.2.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszhtech/WebApiDemo/8b4d77b19d2c5889cbb1e966820830d0ca876844/packages/jQuery.1.10.2/jQuery.1.10.2.nupkg -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | --------------------------------------------------------------------------------