Permalink
Browse files

MVC RC 1 Source Checkin

git-svn-id: https://aspnet.svn.codeplex.com/svn@21528 e17a0e51-4ae3-4d35-97c3-1a29b211df97
  • Loading branch information...
1 parent 33fe7a1 commit 2afae2a3cacc9338652a6fd521ac9e1804b83eb6 SND\AspNetExtensions_cp committed Jan 28, 2009
Showing with 5,003 additions and 4,115 deletions.
  1. +0 −52 MVC/MvcDev.sln
  2. BIN MVC/Symbols/Microsoft.Web.Mvc.pdb
  3. BIN MVC/Symbols/System.Web.Mvc.pdb
  4. +16 −4 MVC/src/MicrosoftMvcAjaxScript/MvcHelpers.cs
  5. +21 −1 MVC/src/MvcFutures/Internal/ExpressionHelper.cs
  6. +0 −19 MVC/src/MvcFutures/Mvc/AntiForgeryExtensions.cs
  7. +0 −61 MVC/src/MvcFutures/Mvc/AntiForgeryHelper.cs
  8. +0 −70 MVC/src/MvcFutures/Mvc/AntiForgeryToken.cs
  9. +0 −12 MVC/src/MvcFutures/Mvc/AntiForgeryTokenSerializer.cs
  10. +0 −32 MVC/src/MvcFutures/Mvc/AntiForgeryTokenValidationException.cs
  11. +0 −56 MVC/src/MvcFutures/Mvc/BinaryResult.cs
  12. +0 −48 MVC/src/MvcFutures/Mvc/BinaryStreamResult.cs
  13. +2 −2 MVC/src/MvcFutures/Mvc/ButtonBuilder.cs
  14. +1 −1 MVC/src/MvcFutures/Mvc/ButtonsAndLinkExtensions.cs
  15. +4 −0 MVC/src/MvcFutures/Mvc/ContentTypeAttribute.cs
  16. +0 −112 MVC/src/MvcFutures/Mvc/DefaultAntiForgeryTokenSerializer.cs
  17. +2 −2 MVC/src/MvcFutures/Mvc/ImageExtensions.cs
  18. +3 −3 MVC/src/MvcFutures/Mvc/LinkBuilder.cs
  19. +1 −1 MVC/src/MvcFutures/Mvc/LinkExtensions.cs
  20. +23 −15 MVC/src/MvcFutures/Mvc/RadioExtensions.cs
  21. +0 −74 MVC/src/MvcFutures/Mvc/ValidateAntiForgeryTokenAttribute.cs
  22. +0 −17 MVC/src/MvcFutures/Mvc/ValidateInputAttribute.cs
  23. +11 −7 MVC/src/MvcFutures/Mvc/ViewExtensions.cs
  24. +59 −12 MVC/src/MvcFutures/MvcFutures.csproj
  25. +2 −1 MVC/src/MvcFutures/Properties/AssemblyInfo.cs
  26. +198 −9 MVC/src/MvcFutures/Resources/MvcResources.Designer.cs
  27. +67 −4 MVC/src/MvcFutures/Resources/MvcResources.resx
  28. +22 −5 MVC/src/SystemWebMvc/Mvc/ActionExecutedContext.cs
  29. +21 −4 MVC/src/SystemWebMvc/Mvc/ActionExecutingContext.cs
  30. +2 −3 MVC/src/SystemWebMvc/Mvc/ActionMethodDispatcher.cs
  31. +5 −28 MVC/src/SystemWebMvc/Mvc/ActionMethodDispatcherCache.cs
  32. +2 −2 MVC/src/SystemWebMvc/Mvc/ActionMethodSelector.cs
  33. +92 −122 MVC/src/SystemWebMvc/Mvc/Ajax/AjaxExtensions.cs
  34. +2 −1 MVC/src/SystemWebMvc/Mvc/Ajax/AjaxOptions.cs
  35. +26 −8 MVC/src/SystemWebMvc/Mvc/AjaxHelper.cs
  36. +6 −5 MVC/src/SystemWebMvc/Mvc/AuthorizationContext.cs
  37. +6 −7 MVC/src/SystemWebMvc/Mvc/AuthorizeAttribute.cs
  38. +0 −70 MVC/src/SystemWebMvc/Mvc/AutoViewEngine.cs
  39. +86 −49 MVC/src/SystemWebMvc/Mvc/Controller.cs
  40. +136 −218 MVC/src/SystemWebMvc/Mvc/ControllerActionInvoker.cs
  41. +18 −5 MVC/src/SystemWebMvc/Mvc/ControllerBase.cs
  42. +80 −17 MVC/src/SystemWebMvc/Mvc/ControllerContext.cs
  43. +3 −1 MVC/src/SystemWebMvc/Mvc/CustomModelBinderAttribute.cs
  44. +407 −300 MVC/src/SystemWebMvc/Mvc/DefaultModelBinder.cs
  45. +0 −60 MVC/src/SystemWebMvc/Mvc/DefaultValueProvider.cs
  46. +10 −3 MVC/src/SystemWebMvc/Mvc/ExceptionContext.cs
  47. +9 −35 MVC/src/SystemWebMvc/Mvc/FilterInfo.cs
  48. +21 −5 MVC/src/SystemWebMvc/Mvc/FormCollection.cs
  49. +5 −0 MVC/src/SystemWebMvc/Mvc/HandleErrorAttribute.cs
  50. +78 −34 MVC/src/SystemWebMvc/Mvc/Html/FormExtensions.cs
  51. +51 −36 MVC/src/SystemWebMvc/Mvc/Html/InputExtensions.cs
  52. +39 −131 MVC/src/SystemWebMvc/Mvc/Html/LinkExtensions.cs
  53. +4 −20 MVC/src/SystemWebMvc/Mvc/Html/RenderPartialExtensions.cs
  54. +64 −66 MVC/src/SystemWebMvc/Mvc/Html/SelectExtensions.cs
  55. +35 −21 MVC/src/SystemWebMvc/Mvc/Html/TextAreaExtensions.cs
  56. +25 −8 MVC/src/SystemWebMvc/Mvc/Html/ValidationExtensions.cs
  57. +134 −17 MVC/src/SystemWebMvc/Mvc/HtmlHelper.cs
  58. +1 −1 MVC/src/SystemWebMvc/Mvc/IModelBinder.cs
  59. +0 −10 MVC/src/SystemWebMvc/Mvc/IValueProvider.cs
  60. +2 −2 MVC/src/SystemWebMvc/Mvc/IViewEngine.cs
  61. +5 −8 MVC/src/SystemWebMvc/Mvc/IViewLocationCache.cs
  62. +0 −22 MVC/src/SystemWebMvc/Mvc/ListItem.cs
  63. +1 −1 MVC/src/SystemWebMvc/Mvc/ModelBinderAttribute.cs
  64. +0 −19 MVC/src/SystemWebMvc/Mvc/ModelBinderResult.cs
  65. +30 −18 MVC/src/SystemWebMvc/Mvc/ModelBinders.cs
  66. +0 −59 MVC/src/SystemWebMvc/Mvc/ModelBindersInfo.cs
  67. +44 −37 MVC/src/SystemWebMvc/Mvc/ModelBindingContext.cs
  68. +8 −7 MVC/src/SystemWebMvc/Mvc/ModelError.cs
  69. +1 −0 MVC/src/SystemWebMvc/Mvc/ModelErrorCollection.cs
  70. +2 −1 MVC/src/SystemWebMvc/Mvc/ModelState.cs
  71. +129 −15 MVC/src/SystemWebMvc/Mvc/ModelStateDictionary.cs
  72. +19 −6 MVC/src/SystemWebMvc/Mvc/MultiSelectList.cs
  73. +26 −1 MVC/src/SystemWebMvc/Mvc/MvcHandler.cs
  74. +2 −0 MVC/src/SystemWebMvc/Mvc/OutputCacheAttribute.cs
  75. +2 −1 MVC/src/SystemWebMvc/Mvc/PartialViewResult.cs
  76. +6 −6 MVC/src/SystemWebMvc/Mvc/RedirectToRouteResult.cs
  77. +13 −7 MVC/src/SystemWebMvc/Mvc/ResultExecutedContext.cs
  78. +9 −3 MVC/src/SystemWebMvc/Mvc/ResultExecutingContext.cs
  79. +1 −1 MVC/src/SystemWebMvc/Mvc/RouteCollectionExtensions.cs
  80. +2 −0 MVC/src/SystemWebMvc/Mvc/SelectList.cs
  81. +19 −7 MVC/src/SystemWebMvc/Mvc/TagBuilder.cs
  82. +15 −3 MVC/src/SystemWebMvc/Mvc/TypeHelpers.cs
  83. +104 −112 MVC/src/SystemWebMvc/Mvc/UrlHelper.cs
  84. +92 −1 MVC/src/SystemWebMvc/Mvc/ValueProviderResult.cs
  85. +30 −20 MVC/src/SystemWebMvc/Mvc/ViewContext.cs
  86. +161 −74 MVC/src/SystemWebMvc/Mvc/ViewDataDictionary.cs
  87. +72 −0 MVC/src/SystemWebMvc/Mvc/ViewEngineCollection.cs
  88. +0 −7 MVC/src/SystemWebMvc/Mvc/ViewEngines.cs
  89. +6 −0 MVC/src/SystemWebMvc/Mvc/ViewMasterPage.cs
  90. +31 −2 MVC/src/SystemWebMvc/Mvc/ViewMasterPage`1.cs
  91. +41 −2 MVC/src/SystemWebMvc/Mvc/ViewPage.cs
  92. +25 −1 MVC/src/SystemWebMvc/Mvc/ViewPage`1.cs
  93. +1 −1 MVC/src/SystemWebMvc/Mvc/ViewResult.cs
  94. +6 −4 MVC/src/SystemWebMvc/Mvc/ViewResultBase.cs
  95. +23 −1 MVC/src/SystemWebMvc/Mvc/ViewUserControl.cs
  96. +26 −0 MVC/src/SystemWebMvc/Mvc/ViewUserControl`1.cs
  97. +51 −13 MVC/src/SystemWebMvc/Mvc/VirtualPathProviderViewEngine.cs
  98. +39 −1 MVC/src/SystemWebMvc/Mvc/WebFormViewEngine.cs
  99. +1 −1 MVC/src/SystemWebMvc/Properties/AssemblyInfo.cs
  100. +99 −72 MVC/src/SystemWebMvc/Resources/MvcResources.Designer.cs
  101. +31 −22 MVC/src/SystemWebMvc/Resources/MvcResources.resx
  102. +55 −16 MVC/src/SystemWebMvc/System.Web.Mvc.csproj
  103. BIN MVC/tools/Moq/Moq.chm
  104. BIN MVC/tools/Moq/Moq.dll
  105. BIN MVC/tools/Moq/Moq.pdb
  106. +1,973 −1,634 MVC/tools/Moq/Moq.xml
View
@@ -1,52 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Mvc", "src\SystemWebMvc\System.Web.Mvc.csproj", "{3D3FFD8A-624D-4E9B-954B-E1C105507975}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{05D54317-D273-4B52-8F3A-027E049C4DB3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Mvc.Test", "test\SystemWebMvcTest\System.Web.Mvc.Test.csproj", "{8AC2A2E4-2F11-4D40-A887-62E2583A65E6}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestUtil", "test\UnitTestUtil\UnitTestUtil.csproj", "{57FFC134-7F9D-4B97-8692-8D2C16714663}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcFutures", "src\MvcFutures\MvcFutures.csproj", "{D3CF7430-6DA4-42B0-BD90-CA39D16687B2}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcFuturesTest", "test\MvcFuturesTest\MvcFuturesTest.csproj", "{6C28DA70-60F1-4442-967F-591BF3962EC5}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicrosoftMvcAjaxScript", "src\MicrosoftMvcAjaxScript\MicrosoftMvcAjaxScript.csproj", "{256C18D8-0A46-4DEC-A9D6-D8073D15F453}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3D3FFD8A-624D-4E9B-954B-E1C105507975}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3D3FFD8A-624D-4E9B-954B-E1C105507975}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3D3FFD8A-624D-4E9B-954B-E1C105507975}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3D3FFD8A-624D-4E9B-954B-E1C105507975}.Release|Any CPU.Build.0 = Release|Any CPU
- {8AC2A2E4-2F11-4D40-A887-62E2583A65E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8AC2A2E4-2F11-4D40-A887-62E2583A65E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8AC2A2E4-2F11-4D40-A887-62E2583A65E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8AC2A2E4-2F11-4D40-A887-62E2583A65E6}.Release|Any CPU.Build.0 = Release|Any CPU
- {57FFC134-7F9D-4B97-8692-8D2C16714663}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {57FFC134-7F9D-4B97-8692-8D2C16714663}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {57FFC134-7F9D-4B97-8692-8D2C16714663}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {57FFC134-7F9D-4B97-8692-8D2C16714663}.Release|Any CPU.Build.0 = Release|Any CPU
- {D3CF7430-6DA4-42B0-BD90-CA39D16687B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D3CF7430-6DA4-42B0-BD90-CA39D16687B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D3CF7430-6DA4-42B0-BD90-CA39D16687B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D3CF7430-6DA4-42B0-BD90-CA39D16687B2}.Release|Any CPU.Build.0 = Release|Any CPU
- {6C28DA70-60F1-4442-967F-591BF3962EC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6C28DA70-60F1-4442-967F-591BF3962EC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6C28DA70-60F1-4442-967F-591BF3962EC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6C28DA70-60F1-4442-967F-591BF3962EC5}.Release|Any CPU.Build.0 = Release|Any CPU
- {256C18D8-0A46-4DEC-A9D6-D8073D15F453}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {256C18D8-0A46-4DEC-A9D6-D8073D15F453}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {256C18D8-0A46-4DEC-A9D6-D8073D15F453}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {256C18D8-0A46-4DEC-A9D6-D8073D15F453}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
Binary file not shown.
Binary file not shown.
@@ -25,7 +25,7 @@ public static class MvcHelpers {
(type == "password") ||
(type == "hidden") ||
(((type == "checkbox") || (type == "radio")) && (bool)Type.GetField(element, "checked"))) {
-
+
formBody.Append(name.EncodeURIComponent());
formBody.Append("=");
formBody.Append(inputElement.Value.EncodeURIComponent());
@@ -78,11 +78,11 @@ public static class MvcHelpers {
if (body.Length > 0 && !body.EndsWith('&')) {
body += "&";
}
- body += "__MVCASYNCPOST=true";
+ body += "X-Requested-With=XMLHttpRequest";
// Determine where to place the body
string requestBody = "";
- if (verb.ToUpperCase() == "GET") {
+ if (verb.ToUpperCase() == "GET" || verb.ToUpperCase() == "DELETE") {
if (url.IndexOf('?') > -1) {
// Case 1: http://foo.bar/baz?abc=123
if (!url.EndsWith('&')) {
@@ -102,9 +102,15 @@ public static class MvcHelpers {
// Create the request
WebRequest request = new WebRequest();
+
request.Url = url;
request.HttpVerb = verb;
request.Body = requestBody;
+ if (verb.ToUpperCase() == "PUT") {
+ request.Headers["Content-Type"] = "application/x-www-form-urlencoded;";
+ }
+ request.Headers["X-Requested-With"] = "XMLHttpRequest";
+
DOMElement updateElement = null;
if (ajaxOptions.UpdateTargetId != null) {
updateElement = Document.GetElementById(ajaxOptions.UpdateTargetId);
@@ -157,7 +163,13 @@ public static class MvcHelpers {
if ((statusCode >= 200 && statusCode < 300) || statusCode == 304 || statusCode == 1223) {
// If the status code is one of 204 (No Content), 304 (Not Modified), or 1223 (IE-specific code caused by 204), don't do the injection
if (statusCode != 204 && statusCode != 304 && statusCode != 1223) {
- UpdateDomElement(ajaxContext.UpdateTarget, ajaxContext.InsertionMode, ajaxContext.Data);
+ string contentType = ajaxContext.Response.GetResponseHeader("Content-Type");
+ if ((contentType != null) && (contentType.IndexOf("application/x-javascript") != -1)) {
+ Script.Eval(ajaxContext.Data);
+ }
+ else {
+ UpdateDomElement(ajaxContext.UpdateTarget, ajaxContext.InsertionMode, ajaxContext.Data);
+ }
}
if (ajaxOptions.OnSuccess != null) {
@@ -5,7 +5,7 @@
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
- using Microsoft.Web.Mvc.Resources;
+ using Microsoft.Web.Resources;
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public static class ExpressionHelper {
@@ -38,6 +38,26 @@ public static class ExpressionHelper {
return rvd;
}
+ public static string GetInputName<TModel, TProperty>(Expression<Func<TModel, TProperty>> expression) {
+ if (expression.Body.NodeType == ExpressionType.Call) {
+ MethodCallExpression methodCallExpression = (MethodCallExpression)expression.Body;
+ string name = GetInputName(methodCallExpression);
+ return name.Substring(expression.Parameters[0].Name.Length + 1);
+
+ }
+ return expression.Body.ToString().Substring(expression.Parameters[0].Name.Length + 1);
+ }
+
+ private static string GetInputName(MethodCallExpression expression) {
+ // p => p.Foo.Bar().Baz.ToString() => p.Foo OR throw...
+
+ MethodCallExpression methodCallExpression = expression.Object as MethodCallExpression;
+ if (methodCallExpression != null) {
+ return GetInputName(methodCallExpression);
+ }
+ return expression.Object.ToString();
+ }
+
static void AddParameterValuesFromExpressionToDictionary(RouteValueDictionary rvd, MethodCallExpression call) {
ParameterInfo[] parameters = call.Method.GetParameters();
@@ -1,19 +0,0 @@
-namespace Microsoft.Web.Mvc {
- using System.Web;
- using System.Web.Mvc;
-
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public static class AntiForgeryExtensions {
-
- private static readonly AntiForgeryHelper _helper = new AntiForgeryHelper();
-
- public static string AntiForgeryToken(this HtmlHelper helper) {
- return AntiForgeryToken(helper, null /* salt */);
- }
-
- public static string AntiForgeryToken(this HtmlHelper helper, string salt) {
- return _helper.AntiForgeryToken(helper, salt);
- }
-
- }
-}
@@ -1,61 +0,0 @@
-namespace Microsoft.Web.Mvc {
- using System;
- using System.Web;
- using System.Web.Mvc;
- using Token = AntiForgeryToken;
-
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public class AntiForgeryHelper {
-
- private const string TokenName = "__MVC_AntiForgeryToken";
-
- private AntiForgeryTokenSerializer _serializer;
-
- protected AntiForgeryTokenSerializer Serializer {
- get {
- return _serializer ?? DefaultAntiForgeryTokenSerializer.Instance;
- }
- set {
- _serializer = value;
- }
- }
-
- public string AntiForgeryToken(HtmlHelper helper, string salt) {
- if (helper == null) {
- throw new ArgumentNullException("helper");
- }
-
- string formValue = GetAntiForgeryToken(helper.ViewContext.HttpContext, salt);
-
- TagBuilder builder = new TagBuilder("input");
- builder.Attributes["type"] = "hidden";
- builder.Attributes["name"] = TokenName;
- builder.Attributes["value"] = formValue;
- return builder.ToString(TagRenderMode.SelfClosing);
- }
-
- private string GetAntiForgeryToken(HttpContextBase httpContext, string salt) {
- Token cookieToken;
- HttpCookie cookie = httpContext.Request.Cookies[TokenName];
- if (cookie != null) {
- cookieToken = Serializer.Deserialize(cookie.Value);
- }
- else {
- cookieToken = Token.NewToken();
- string cookieValue = Serializer.Serialize(cookieToken);
- HttpCookie newCookie = new HttpCookie(TokenName, cookieValue);
- httpContext.Response.Cookies.Set(newCookie);
- }
-
-
- Token formToken = new AntiForgeryToken(cookieToken) {
- CreationDate = DateTime.Now,
- Salt = salt
- };
- string formValue = Serializer.Serialize(formToken);
- return formValue;
- }
-
- }
-}
@@ -1,70 +0,0 @@
-namespace Microsoft.Web.Mvc {
- using System;
- using System.Security.Cryptography;
- using System.Web;
-
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public sealed class AntiForgeryToken {
-
- private const int TokenLength = 128 / 8;
-
- private static RNGCryptoServiceProvider _prng = new RNGCryptoServiceProvider();
-
- private string _salt;
- private string _value;
-
- public AntiForgeryToken() {
- }
-
- // copy constructor
- public AntiForgeryToken(AntiForgeryToken token) {
- if (token == null) {
- throw new ArgumentNullException("token");
- }
-
- CreationDate = token.CreationDate;
- Salt = token.Salt;
- Value = token.Value;
- }
-
- public DateTime CreationDate {
- get;
- set;
- }
-
- public string Salt {
- get {
- return _salt ?? String.Empty;
- }
- set {
- _salt = value;
- }
- }
-
- public string Value {
- get {
- return _value ?? String.Empty;
- }
- set {
- _value = value;
- }
- }
-
- private static string GenerateRandomTokenString() {
- byte[] tokenBytes = new byte[TokenLength];
- _prng.GetBytes(tokenBytes);
-
- string token = Convert.ToBase64String(tokenBytes);
- return token;
- }
-
- public static AntiForgeryToken NewToken() {
- string tokenString = GenerateRandomTokenString();
- return new AntiForgeryToken() {
- CreationDate = DateTime.Now,
- Value = tokenString
- };
- }
-
- }
-}
@@ -1,12 +0,0 @@
-namespace Microsoft.Web.Mvc {
- using System.Web;
-
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public abstract class AntiForgeryTokenSerializer {
-
- public abstract string Serialize(AntiForgeryToken token);
- public abstract AntiForgeryToken Deserialize(string serializedToken);
-
- }
-}
@@ -1,32 +0,0 @@
-namespace Microsoft.Web.Mvc {
- using System;
- using System.Runtime.Serialization;
- using System.Web;
-
- [Serializable]
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public class AntiForgeryTokenValidationException : Exception {
- //
- // For guidelines regarding the creation of new exception types, see
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
- // and
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
- //
-
- public AntiForgeryTokenValidationException() {
- }
-
- public AntiForgeryTokenValidationException(string message)
- : base(message) {
- }
-
- public AntiForgeryTokenValidationException(string message, Exception inner)
- : base(message, inner) {
- }
-
- protected AntiForgeryTokenValidationException(SerializationInfo info, StreamingContext context)
- : base(info, context) {
- }
- }
-}
@@ -1,56 +0,0 @@
-namespace Microsoft.Web.Mvc {
- using System;
- using System.Net.Mime;
- using System.Web;
- using System.Web.Mvc;
-
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- [AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public abstract class BinaryResult : ActionResult {
-
- private const string _defaultContentType = MediaTypeNames.Application.Octet;
-
- private string _contentType;
- private string _fileDownloadName;
-
- public string ContentType {
- get {
- if (String.IsNullOrEmpty(_contentType)) {
- _contentType = _defaultContentType;
- }
- return _contentType;
- }
- set {
- _contentType = value;
- }
- }
-
- public string FileDownloadName {
- get {
- return _fileDownloadName ?? String.Empty;
- }
- set {
- _fileDownloadName = value;
- }
- }
-
- public override void ExecuteResult(ControllerContext context) {
- if (context == null) {
- throw new ArgumentNullException("context");
- }
-
- context.HttpContext.Response.ContentType = ContentType;
-
- if (!String.IsNullOrEmpty(FileDownloadName)) {
- // From RFC 1806, Sec. 2.3:
- // The sender may want to suggest a filename to be used if the entity is
- // detached and stored in a separate file. If the receiving MUA writes
- // the entity to a file, the suggested filename should be used as a
- // basis for the actual filename, where possible.
- string headerValue = "attachment; filename=" + HttpUtility.UrlEncode(FileDownloadName);
- context.HttpContext.Response.AddHeader("Content-Disposition", headerValue);
- }
- }
-
- }
-}
Oops, something went wrong.

0 comments on commit 2afae2a

Please sign in to comment.