Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all 7215 articles
Browse latest View live

Created Unassigned: $select response on Json formatter not maintaning the order of properties mentioned in the $select query. [1049]

$
0
0
I checked with OData formatter and there the order is maintained as expected.

__Request(note the order of properties):__
http://localhost:63523/api/Categories?$top=3&$select=Description,CategoryName

__Response:__
[{"CategoryName":"Beverages","Description":"Soft drinks, coffees, teas, beers, and ales"},{"CategoryName":"Condiments","Description":"Sweet and savory sauces, relishes, spreads, and seasonings"},{"CategoryName":"Confections","Description":"Desserts, candies, and sweet breads"}]

I have the following model for Category(from Northwind):
```
namespace SampleWebApiApp.Models
{
using System;
using System.Collections.Generic;

public partial class Category
{
public Category()
{
this.Products = new HashSet<Product>();
}

public int CategoryID { get; set; }
public string CategoryName { get; set; }
public string Description { get; set; }
public byte[] Picture { get; set; }

public virtual ICollection<Product> Products { get; set; }
}
}
```

Edited Unassigned: $select response on Json formatter not maintaning the order of properties mentioned in the $select query. [1049]

$
0
0
I checked with OData formatter and there the order is maintained as expected.

Request(note the order of properties):
http://localhost:63523/api/Categories?$top=3&$select=Description,CategoryName

Response:
[{"CategoryName":"Beverages","Description":"Soft drinks, coffees, teas, beers, and ales"},{"CategoryName":"Condiments","Description":"Sweet and savory sauces, relishes, spreads, and seasonings"},{"CategoryName":"Confections","Description":"Desserts, candies, and sweet breads"}]

I have the following model for Category(from Northwind):
```
namespace SampleWebApiApp.Models
{
using System;
using System.Collections.Generic;

public partial class Category
{
public Category()
{
this.Products = new HashSet<Product>();
}

public int CategoryID { get; set; }
public string CategoryName { get; set; }
public string Description { get; set; }
public byte[] Picture { get; set; }

public virtual ICollection<Product> Products { get; set; }
}
}
```

Commented Issue: input type="date" not in correct format [457]

$
0
0
I just ran across this issue today in Chrome. If you create a page with the following

Model:

public class Model {
[DataType(DataType.Date)]
public DateTime LastModified { get; set; }
}

Page:

@Html.EditorFor(x => x.LastModified)

Generates This:

<input type="date" value="01/01/2001" />

However the specs require an RFC 3339 / ISO 8601 Date. The Chrome browser refuses to use the date in this format. Here is the line to the spec.

http://dev.w3.org/html5/markup/datatypes.html#form.data.date

In order to get this to work in MVC4 I have to use the following:

@Html.TextBox(
name: "LastModified"
value: Model.LastModified.ToString("yyyy-MM-dd"),
htmlAttributes: new { type="date" })


Comments: This bug is giving me a lot of headaches. Please fix it soon.

Created Unassigned: [CORS] Preflight request failed when there's an HttpOptions route attribute [1050]

$
0
0
This is reported by a customer. See more details here: https://aspnetwebstack.codeplex.com/discussions/441725#editor
Repro attached.

Commented Issue: Empty SingleResult cannot be formatted by the ODataFormatter [1040]

$
0
0


public override SingleResult<Customer> GetCustomer(int key)
{
return SingleResult.Create(Enumerable.Empty<Customer>());
}
Comments: I am not entirely sure what the expected behaviour here is. should it cause a 404? should it return an empty feed? Is this even a reasonable scenario? when returning a single result, I'd expect the user to either return a real value, or null. or have something like SingleResult<T>.Empty (for structs).

Commented Unassigned: Allow specifying the iteration count in System.Web.Helpers.Crypto.HashPassword() [1047]

$
0
0
The current implementation of Crypto.HashPassword() uses a hard-coded iteration count for the PBKDF2 algorithm of 1,000 ([Crypto.cs](https://aspnetwebstack.codeplex.com/SourceControl/latest#src/System.Web.Helpers/Crypto.cs)). This is the minimum recommended iteration count as specified in RFC2898, published in September 2000.

Given the hardware advancements in recent years, this number seems to be very low (e.g. LastPass now uses 100,000 PBKDF2 iterations for the master password, Django defaults to 10,000).

The whole point of using PBKDF2 is that the number of iterations can be increased when hardware gets faster, so I think it would make sense to provide an overload for HashPassword() that takes the iteration count as a parameter.

Sources:
[1] http://stackoverflow.com/questions/6054082/recommended-of-iterations-when-using-pkbdf2-sha256
[2] http://www.levigross.com/post/18880148948/a-review-of-djangos-new-password-authentication
Comments: The password hashing method is there for existing built-in security systems and fits their design goals. For implementing a different password hashing mechanism, we recommend to implement your own method, after carefully weighing the security vs. scaling/server load and dos attack risk. Keep in mind that many of the examples above relate to applications where the password hashes can be relatively easily be accessed by an attacker, and hashing is the first line of defense, also in these cases there is typically only thread trying to hash a password, in contrast to server implementation when password hashing might even happen on every request in some cases, causing a significant server load.

Closed Unassigned: Allow specifying the iteration count in System.Web.Helpers.Crypto.HashPassword() [1047]

$
0
0
The current implementation of Crypto.HashPassword() uses a hard-coded iteration count for the PBKDF2 algorithm of 1,000 ([Crypto.cs](https://aspnetwebstack.codeplex.com/SourceControl/latest#src/System.Web.Helpers/Crypto.cs)). This is the minimum recommended iteration count as specified in RFC2898, published in September 2000.

Given the hardware advancements in recent years, this number seems to be very low (e.g. LastPass now uses 100,000 PBKDF2 iterations for the master password, Django defaults to 10,000).

The whole point of using PBKDF2 is that the number of iterations can be increased when hardware gets faster, so I think it would make sense to provide an overload for HashPassword() that takes the iteration count as a parameter.

Sources:
[1] http://stackoverflow.com/questions/6054082/recommended-of-iterations-when-using-pkbdf2-sha256
[2] http://www.levigross.com/post/18880148948/a-review-of-djangos-new-password-authentication

Created Unassigned: input type = email jquery validate overriding mvc data annotation [1051]

$
0
0
See http://stackoverflow.com/questions/16523525/input-type-email-jquery-validate-overriding-mvc-data-annotation

Created Unassigned: Add-Migration error: Schema specified is not valid. [1052]

$
0
0

Can not use migrations with version?

Microsoft.AspNet.WebApi -> 5.0.0-beta1-130514
Microsoft.AspNet.WebApi.Client -> 5.0.0-beta1-130514
Microsoft.AspNet.WebApi.Core -> 5.0.0-beta1-130514
Microsoft.AspNet.WebApi.OData -> 5.0.0-beta1-130514
Microsoft.AspNet.WebApi.Web... -> 5.0.0-beta1-130514


Error:

```
PM> Add-Migration test
System.Data.Entity.Core.MappingException: Schema specified is not valid. Errors:
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
at System.Data.Entity.Core.Mapping.StorageMappingItemCollection.Init(EdmItemCollection edmCollection, StoreItemCollection storeCollection, IEnumerable`1 xmlReaders, IList`1 filePaths, Boolean throwOnError)
at System.Data.Entity.Core.Mapping.StorageMappingItemCollection..ctor(EdmItemCollection edmCollection, StoreItemCollection storeCollection, IEnumerable`1 xmlReaders)
at System.Data.Entity.Utilities.XDocumentExtensions.GetStorageMappingItemCollection(XDocument model, DbProviderInfo& providerInfo)
at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, ModificationCommandTreeGenerator modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator)
at System.Data.Entity.Migrations.DbMigrator.Scaffold(String migrationName, String namespace, Boolean ignoreChanges)
at System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(String migrationName, Boolean ignoreChanges)
at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold(MigrationScaffolder scaffolder)
at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(String migrationName, String language, String rootNamespace, Boolean ignoreChanges)
at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges)
at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Schema specified is not valid. Errors:
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' attribute is not declared..
```

Commented Unassigned: $select and $expand not working properly for complex types in json formatter [1048]

$
0
0
Given the following model:

```
public class JsonSelectCustomer
{
public int Id { get; set; }
public string Name { get; set; }
public virtual IList<JsonSelectOrder> JsonSelectOrders { get; set; }
}

public class JsonSelectPremiumCustomer : JsonSelectCustomer
{
public string Category { get; set; }
public IList<JsonSelectBonus> Bonuses { get; set; }
}

public class JsonSelectBonus
{
public int Id { get; set; }
public double Ammount { get; set; }
}

public class JsonSelectOrder
{
public int Id { get; set; }
public DateTime Date { get; set; }
public JsonSelectAddress BillingAddress { get; set; }
public virtual IList<JsonSelectOrderDetail> OrderDetails { get; set; }
}

public class JsonSelectAddress
{
public string FirstLine { get; set; }
public string SecondLine { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Country { get; set; }
}

public class JsonSelectOrderDetail
{
public int Id { get; set; }
public string Name { get; set; }
public int Ammount { get; set; }
public double Price { get; set; }
}
```

When a customer issues the following query:
/api/JsonSelectCustomer?$select=Id,JsonSelectOrders&$expand=JsonSelectOrders

The JsonSelectAddress property doesn't get serialized as it does in the OData case.
Here is the response payload sample:

```
[
{
"Id": 0,
"JsonSelectOrders": []
},
{
"Id": 1,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2454402-07:00"
}
]
},
{
"Id": 2,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2464399-07:00"
},
{
"Id": 1,
"Date": "2013-05-13T11:20:45.2464399-07:00"
}
]
},
{
"Id": 3,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2474403-07:00"
},
{
"Id": 1,
"Date": "2013-05-13T11:20:45.2474403-07:00"
},
{
"Id": 2,
"Date": "2013-05-12T11:20:45.2474403-07:00"
}
]
},
{
"Id": 4,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2474403-07:00"
},
{
"Id": 1,
"Date": "2013-05-13T11:20:45.2474403-07:00"
},
{
"Id": 2,
"Date": "2013-05-12T11:20:45.2474403-07:00"
},
{
"Id": 3,
"Date": "2013-05-11T11:20:45.2474403-07:00"
}
]
},
{
"Id": 5,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2474403-07:00"
},
{
"Id": 1,
"Date": "2013-05-13T11:20:45.2474403-07:00"
},
{
"Id": 2,
"Date": "2013-05-12T11:20:45.2474403-07:00"
},
{
"Id": 3,
"Date": "2013-05-11T11:20:45.2474403-07:00"
},
{
"Id": 4,
"Date": "2013-05-10T11:20:45.2474403-07:00"
}
]
},
{
"Id": 6,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2474403-07:00"
},
{
"Id": 1,
"Date": "2013-05-13T11:20:45.2474403-07:00"
},
{
"Id": 2,
"Date": "2013-05-12T11:20:45.2474403-07:00"
},
{
"Id": 3,
"Date": "2013-05-11T11:20:45.2474403-07:00"
},
{
"Id": 4,
"Date": "2013-05-10T11:20:45.2474403-07:00"
},
{
"Id": 5,
"Date": "2013-05-09T11:20:45.2474403-07:00"
}
]
},
{
"Id": 7,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2474403-07:00"
},
{
"Id": 1,
"Date": "2013-05-13T11:20:45.2474403-07:00"
},
{
"Id": 2,
"Date": "2013-05-12T11:20:45.2474403-07:00"
},
{
"Id": 3,
"Date": "2013-05-11T11:20:45.2474403-07:00"
},
{
"Id": 4,
"Date": "2013-05-10T11:20:45.2474403-07:00"
},
{
"Id": 5,
"Date": "2013-05-09T11:20:45.2474403-07:00"
},
{
"Id": 6,
"Date": "2013-05-08T11:20:45.2474403-07:00"
}
]
},
{
"Id": 8,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2474403-07:00"
},
{
"Id": 1,
"Date": "2013-05-13T11:20:45.2474403-07:00"
},
{
"Id": 2,
"Date": "2013-05-12T11:20:45.2474403-07:00"
},
{
"Id": 3,
"Date": "2013-05-11T11:20:45.2474403-07:00"
},
{
"Id": 4,
"Date": "2013-05-10T11:20:45.2474403-07:00"
},
{
"Id": 5,
"Date": "2013-05-09T11:20:45.2474403-07:00"
},
{
"Id": 6,
"Date": "2013-05-08T11:20:45.2474403-07:00"
},
{
"Id": 7,
"Date": "2013-05-07T11:20:45.2474403-07:00"
}
]
},
{
"Id": 9,
"JsonSelectOrders": [
{
"Id": 0,
"Date": "2013-05-14T11:20:45.2474403-07:00"
},
{
"Id": 1,
"Date": "2013-05-13T11:20:45.2474403-07:00"
},
{
"Id": 2,
"Date": "2013-05-12T11:20:45.2474403-07:00"
},
{
"Id": 3,
"Date": "2013-05-11T11:20:45.2474403-07:00"
},
{
"Id": 4,
"Date": "2013-05-10T11:20:45.2474403-07:00"
},
{
"Id": 5,
"Date": "2013-05-09T11:20:45.2474403-07:00"
},
{
"Id": 6,
"Date": "2013-05-08T11:20:45.2474403-07:00"
},
{
"Id": 7,
"Date": "2013-05-07T11:20:45.2474403-07:00"
},
{
"Id": 8,
"Date": "2013-05-06T11:20:45.2474403-07:00"
}
]
}
]
```


Comments: This is by-design. The OData conventional model builder treats all types as entities for the implicit model we build for query composition. This is due to the limitations that OData protocol has in v3 on complex types like complex types cannot refer to entity types. As address is an entity type, we don't expand it unless it is explicitly expanded through the query option $expand.

Commented Unassigned: $select response on Json formatter not maintaning the order of properties mentioned in the $select query. [1049]

$
0
0
I checked with OData formatter and there the order is maintained as expected.

Request(note the order of properties):
http://localhost:63523/api/Categories?$top=3&$select=Description,CategoryName

Response:
[{"CategoryName":"Beverages","Description":"Soft drinks, coffees, teas, beers, and ales"},{"CategoryName":"Condiments","Description":"Sweet and savory sauces, relishes, spreads, and seasonings"},{"CategoryName":"Confections","Description":"Desserts, candies, and sweet breads"}]

I have the following model for Category(from Northwind):
```
namespace SampleWebApiApp.Models
{
using System;
using System.Collections.Generic;

public partial class Category
{
public Category()
{
this.Products = new HashSet<Product>();
}

public int CategoryID { get; set; }
public string CategoryName { get; set; }
public string Description { get; set; }
public byte[] Picture { get; set; }

public virtual ICollection<Product> Products { get; set; }
}
}
```
Comments: Although this should be easy to fix, I dont see what is wrong with not maintaining the order. Can you explain the scenario?

Commented Issue: Empty SingleResult cannot be formatted by the ODataFormatter [1040]

$
0
0


public override SingleResult<Customer> GetCustomer(int key)
{
return SingleResult.Create(Enumerable.Empty<Customer>());
}
Comments: Yes, it is. The problem is that people return SingleResult<T> with code like this, ``` return SingleResult.Create(_db.Customers.Where(c => c.Id == id); ``` As you can see, figuring out whether there the singleresult is empty or not requires one more query which is not efficient. The expected behavior is 404 from the advisors call that we had the other day.

Closed Issue: Warnings found when building clean project [482]

$
0
0
Warning 1 A custom tool 'ResXFileCodeGenerator' is associated with file 'Common\CommonResources.resx', but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool. Microsoft.Web.WebPages.OAuth
Comments: We have not seen this come up recently.

Commented Issue: [Regression]Required attribute on string property is not honored when request is sent as string content [1039]

$
0
0
Build - May 8th
My model

public class ValidationModel
{
public int Id { get; set; }

[Required]
[Range(1,10)]
public int IntReq { get; set; }

[Required]
public int IntNotReqAndDMIsReq { get; set; }

[Required]
public string StrNotReqAndDMIsReq { get; set; }
}

I am making following request
var jsonEncodedBadObject = "{\"Id\": 4}";
object mediaTypeFormatter = "application/json";
request.Content = new StringContent((string)jsonEncodedBadObject, System.Text.Encoding.UTF8, (string)mediaTypeFormatter);

I am seeing following errors when I get a response
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.


When I used April 25th build, I am seeing missing string property in Json errors too.

I am seeing
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
__Exception:Required property 'StrNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.__

If you have add DataContract attribute to class and [DataMember(IsRequired = true)] on string property, you see following in response
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
{}
Key=model.IntReq
Value
The field IntReq must be between 1 and 10.

Note: StrNotReqAndDMIsReq validation is missing

I attached fiddler session.
1st one is April 25th build with [Required] attributes on properties
2nd one is latest build with [Required] attribute on properties
3rd one is the latest build with [DataMember(IsRequired=true)] attribute on string property
Comments: This is by design as part of this fix to avoid duplicate errors for reference-typed [Required] properties: https://aspnetwebstack.codeplex.com/workitem/590 Users should still be presented with a missing required member error: "model.StrNotReqAndDMIsReq": [ "The StrNotReqAndDMIsReq field is required." ]

Closed Issue: [Regression]Required attribute on string property is not honored when request is sent as string content [1039]

$
0
0
Build - May 8th
My model

public class ValidationModel
{
public int Id { get; set; }

[Required]
[Range(1,10)]
public int IntReq { get; set; }

[Required]
public int IntNotReqAndDMIsReq { get; set; }

[Required]
public string StrNotReqAndDMIsReq { get; set; }
}

I am making following request
var jsonEncodedBadObject = "{\"Id\": 4}";
object mediaTypeFormatter = "application/json";
request.Content = new StringContent((string)jsonEncodedBadObject, System.Text.Encoding.UTF8, (string)mediaTypeFormatter);

I am seeing following errors when I get a response
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.


When I used April 25th build, I am seeing missing string property in Json errors too.

I am seeing
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
__Exception:Required property 'StrNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.__

If you have add DataContract attribute to class and [DataMember(IsRequired = true)] on string property, you see following in response
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
{}
Key=model.IntReq
Value
The field IntReq must be between 1 and 10.

Note: StrNotReqAndDMIsReq validation is missing

I attached fiddler session.
1st one is April 25th build with [Required] attributes on properties
2nd one is latest build with [Required] attribute on properties
3rd one is the latest build with [DataMember(IsRequired=true)] attribute on string property
Comments: This is by design as part of this fix to avoid duplicate errors for reference-typed [Required] properties: https://aspnetwebstack.codeplex.com/workitem/590

Commented Unassigned: Batching handlers should copy properties from batch request to dynamically created requests. [996]

$
0
0
WebApi-on-Owin's HttpMessageHandlerAdapter populates following properties on an incoming request:

MS_RetrieveClientCertificateDelegate
MS_IsLocal

When a batching request comes in these are populated on the batching request, but we should also copy these properties onto all the dynamically created requests that we create at the batching handler.

This is so that a user expecting a certain property in a request shouldn't see different behavior when the action is invoked as a regular single request or as part of a batch request.

This problem should be happening on SelfHost and WebHosts too.

__Attached__ a standalone Katana repro.
Comments: Fixed: https://aspnetwebstack.codeplex.com/SourceControl/changeset/7a69495ddb7e27400ee57d6db2c60a5209b53630

Edited Issue: UrlHelper throws MethodNotimplementedException with batching in webhost [215]

$
0
0
With the following batching code in webhost,

HttpConfiguration memoryConfig = new HttpConfiguration();
HttpServer memoryServer = new HttpServer(memoryConfig, GlobalConfiguration.DefaultHandler);
GlobalConfiguration.Configuration.MessageHandlers.Add(new BatchingMessageHandler(memoryServer));


we receive a MethodNotimplementedException while using UrlHelper.Route in the following action,

[ActionName("link"), HttpGet]
public string GetUrl()
{
return Url.Link("API Default", new { Controller = "batch", Action = "contacts" });
}


The issue here is that the routing is handled by HostedHttpRoute which expects the HttpRequestMessage to have a underlying asp.net HttpContextBase. But the request message that matches the route is a vanilla HttpRequestMessage created by the BatchingMessageHandler without any underlying HttpContextBase.


Fortunately, there is a workaround. Instead of reusing the routes from GlobalConfguration we need to create HttpRoute (not HostedHttpRoute) in the memory server of the BatchingHandler to make this scenario work like,

HttpConfiguration memoryConfig = new HttpConfiguration();
memoryConfig.MessageHandlers.Add(new SampleMemoryMessageHandler());
memoryConfig.Routes.MapHttpRoute(
name: "API Default",
routeTemplate: "app/api/{controller}/{action}",
defaults: new { controller = "Batch", action = RouteParameter.Optional }
);
HttpServer memoryServer = new HttpServer(memoryConfig);



Stack trace for the exception.

System.Web.dll!System.Web.HttpContextBase.Response.get() + 0x1e bytes
System.Web.dll!System.Web.Routing.RouteCollection.GetUrlWithApplicationPath(System.Web.Routing.RequestContext requestContext, string url) + 0x86 bytes
System.Web.dll!System.Web.Routing.RouteCollection.GetVirtualPath(System.Web.Routing.RequestContext requestContext, string name, System.Web.Routing.RouteValueDictionary values) + 0xd9 bytes
> System.Web.Http.WebHost.DLL!System.Web.Http.WebHost.Routing.HostedHttpRouteCollection.GetVirtualPath(System.Net.Http.HttpRequestMessage request, string name, System.Collections.Generic.IDictionary<string,object> values) Line 114 + 0x22 bytes C#


Commented Issue: UrlHelper throws MethodNotimplementedException with batching in webhost [215]

$
0
0
With the following batching code in webhost,

HttpConfiguration memoryConfig = new HttpConfiguration();
HttpServer memoryServer = new HttpServer(memoryConfig, GlobalConfiguration.DefaultHandler);
GlobalConfiguration.Configuration.MessageHandlers.Add(new BatchingMessageHandler(memoryServer));


we receive a MethodNotimplementedException while using UrlHelper.Route in the following action,

[ActionName("link"), HttpGet]
public string GetUrl()
{
return Url.Link("API Default", new { Controller = "batch", Action = "contacts" });
}


The issue here is that the routing is handled by HostedHttpRoute which expects the HttpRequestMessage to have a underlying asp.net HttpContextBase. But the request message that matches the route is a vanilla HttpRequestMessage created by the BatchingMessageHandler without any underlying HttpContextBase.


Fortunately, there is a workaround. Instead of reusing the routes from GlobalConfguration we need to create HttpRoute (not HostedHttpRoute) in the memory server of the BatchingHandler to make this scenario work like,

HttpConfiguration memoryConfig = new HttpConfiguration();
memoryConfig.MessageHandlers.Add(new SampleMemoryMessageHandler());
memoryConfig.Routes.MapHttpRoute(
name: "API Default",
routeTemplate: "app/api/{controller}/{action}",
defaults: new { controller = "Batch", action = RouteParameter.Optional }
);
HttpServer memoryServer = new HttpServer(memoryConfig);



Stack trace for the exception.

System.Web.dll!System.Web.HttpContextBase.Response.get() + 0x1e bytes
System.Web.dll!System.Web.Routing.RouteCollection.GetUrlWithApplicationPath(System.Web.Routing.RequestContext requestContext, string url) + 0x86 bytes
System.Web.dll!System.Web.Routing.RouteCollection.GetVirtualPath(System.Web.Routing.RequestContext requestContext, string name, System.Web.Routing.RouteValueDictionary values) + 0xd9 bytes
> System.Web.Http.WebHost.DLL!System.Web.Http.WebHost.Routing.HostedHttpRouteCollection.GetVirtualPath(System.Net.Http.HttpRequestMessage request, string name, System.Collections.Generic.IDictionary<string,object> values) Line 114 + 0x22 bytes C#


Comments: Fixed: https://aspnetwebstack.codeplex.com/SourceControl/changeset/647f958b1ba7462f2da722fa5e807d5595d23c4b

Commented Issue: CookieHeaderValue.TryParse() invalid date time format [298]

$
0
0
When I try to parse next cookie:

.ASPXAUTH=4739F5D3BE64150EBD2259869A846B3BC2F30A09B3666868FFBC5A11435BA1998D7FF3C2AF5E8ACB9E88FCF2C087B0959C53C590583799831582F3AE42F41349FA1589383FF41B2C445E100F56AEE464033F74A992DA4ED11AB99976E1F44E86AAD4571E952AEA3519926F4C58AC1D8748A5C872ECA0A7872E7E2E136F4999EFDC97698C30A2ECD1FD249F2B37EC3A8AE49EDC47DCA7E9C23C84F0D469E0495F51A25485F73CF07405147741D6AC3620; expires=Tue, 31-Jul-2012 20:18:50 GMT; path=/; HttpOnly

using CookieHeaderValue.TryParse, I always get FALSE result. It seems to me, that there is no proper date format acceptable with cookie expire date in System.Net.Http.Formatting/FormattingUtilities.cs
Comments: I'd like to request that you re-open this issue. HttpUtility uses the date format "ddd, dd-MMM-yyyy HH':'mm':'ss 'GMT'" to generate response cookie headers (see the internal FormatHttpCookieDateTime method). Cookies stored in ASP.Net's HttpResponse.HttpCookieCollection, which include the FormsAuthentication cookie, all appear to use this HttpUtility method. As such, in order to use CookieHeaderValue in concert with this standard ASP.Net functionality (a reasonable use case in my opinion), support of this date format is necessary. That is, unless I am unaware of the ability to control how the Expires DateTime is generated for HttpCookieCollection cookies?

Edited Issue: OData $batch sends the wrong response when a request within a changeset fails [1033]

$
0
0
Given a $batch request like the following, where the second operation in the changeset fails as this one

```
POST http://jcalvarro-wsr3:9001/batch/$batch HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: multipart/mixed; boundary=batch_e4243eef-ba43-49da-8dfb-a006d9e918f2
Accept: multipart/mixed
Accept-Charset: UTF-8
User-Agent: Microsoft ADO.NET Data Services
Host: jcalvarro-wsr3:9001
Content-Length: 1076
Expect: 100-continue
Connection: Keep-Alive

--batch_e4243eef-ba43-49da-8dfb-a006d9e918f2
Content-Type: multipart/mixed; boundary=changeset_6bb58eec-2717-4673-b074-919584c38eea

--changeset_6bb58eec-2717-4673-b074-919584c38eea
Content-Type: application/http
Content-Transfer-Encoding: binary

POST http://jcalvarro-wsr3:9001/batch/BatchCustomer HTTP/1.1
Content-ID: 1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8

{"Id":10,"Name":"Customer 10"}
--changeset_6bb58eec-2717-4673-b074-919584c38eea
Content-Type: application/http
Content-Transfer-Encoding: binary

POST http://jcalvarro-wsr3:9001/batch/BatchCustomer HTTP/1.1
Content-ID: 2
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8

{"Id":-1,"Name":"Customer -1"}
--changeset_6bb58eec-2717-4673-b074-919584c38eea--
--batch_e4243eef-ba43-49da-8dfb-a006d9e918f2--
```

the current response is the following

```

HTTP/1.1 202 Accepted
Content-Length: 886
Content-Type: multipart/mixed; boundary=batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f
Server: Microsoft-HTTPAPI/2.0
DataServiceVersion: 3.0
Date: Mon, 06 May 2013 20:52:22 GMT

--batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f
Content-Type: multipart/mixed; boundary=changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f

--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 201 Created
Location: http://jcalvarro-wsr3:9001/batch/BatchCustomer(10)
Content-ID: 1
Content-Type: application/json; odata=minimalmetadata; charset=utf-8
DataServiceVersion: 3.0

{
"odata.metadata":"http://jcalvarro-wsr3:9001/batch/$metadata#BatchCustomer/@Element","Id":10,"Name":"Customer 10"
}
--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 400 Bad Request
Content-ID: 2


--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f--
--batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f--
```

and according to the OData spec, it should be as follows:

Structurally, a batch response body MUST match one-to-one with the corresponding batch request body, such that the same multipart MIME message structure defined for requests is used for responses.
The exception to this rule is that when a request within a Change Set fails, the Change Set response is not represented using the multipart/mixed media type.
Instead, a single response, using the “application/http” media type and a Content-Transfer-Encoding header with a value of “binary”,
is returned that applies to all requests in the Change Set and MUST be formatted according to the Error Handling section of [OData:Core].
Viewing all 7215 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>