Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all 7925 articles
Browse latest View live

Reviewed: v4.0 RTM (五月 23, 2013)

$
0
0
Rated 4 Stars (out of 5) - great i like it!

Commented Issue: Razor code formatting is broken when using tabs in VS2012 MVC 4 [398]

$
0
0
When using "Keep tabs" instead of the default "Insert spaces", and running "Fomat document" (CTRL-E, CTRL-D) on in a .cshtml file with razor code any ifs inside other markup gets "mangled". I've attached a screenshot with a comparison of space and tab formatting.

Repro:
In Visual Studio 2012 (I'm using premium), create a new ASP.NET MVC 4 project (using the default web site template).
Open "Tools"->"Options"->"Text Editor"->"All Languages"->"Tabs" and set "Keep tabs" instead of "Insert spaces".
Open any view (.cshtml) and insert:
<div>
@if(true) {
}
</div>

Run format document (CTRL-E, CTRL-D).
Comments: Wondering if anyone has heard of any progress on this.

Commented Feature: Make the ApiControllerActionSelector more extensible [277]

$
0
0
The goal is to have the default action selector (ApiControllerActionSelector) expose some hooks or properties so that it's easier to customize.
Comments: A yes vote from me.

New Post: Odata batch issue - with nightly

$
0
0
Everything looks good but I'm worried about the following headers. Are you using CORS?

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST,GET,DELETE,PATCH,PUT,OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization, Accept,WWW-Authenticate

Have your tried using the ODataConventionModelBuilder?
Can you share the classes?
Can you share a small repro if you have it?

My guess is that it could be an exception within the pipeline that we capture. Do you have the break on all exceptions enabled?

Created Unassigned: Provide an EmptyAuthenticationResult that signals the pipeline that there is no authentication information present on the request [1062]

$
0
0
When implementing an IAuthenticationFilter, in the AuthenticateAsync method you can return one of the out of the box implemented classes: SuccessfullAuthenticationResult or FailedAuthenticationResult to signal the result of the operation.
However, the possibles outcomes of the AuthenticateAsync method are really three:
Success: Meaning that the authentication information was present on the request and was correct.
Failure: Meaning that the authentication information was present on the request but was incorrect.
Empty: Meaning that there is no authentication information on the request.

In order to signal this third state, the user can return Task.FromResult(null), but this is confusing as there are classes for the other two states and there is no easy way to know that returning null will just work.
Its more clear to have an explicit class EmptyAuthenticationResult that the user can return when creating his own authentication filter.

The resulting implementation will look like in pseudocode:

```
public Task<IAuthenticationResult> AuthenticateAsync(params)
{
if(requestContainsAuthenticationInformation){
if(authenticationInfo)
{
return new SucessfulAuthentication(principal);
}
else
{
return new FailedAuthentication(error);
}
}
return new EmptyAuthenticationResult();
}
```

Commented Issue: Razor code formatting is broken when using tabs in VS2012 MVC 4 [398]

$
0
0
When using "Keep tabs" instead of the default "Insert spaces", and running "Fomat document" (CTRL-E, CTRL-D) on in a .cshtml file with razor code any ifs inside other markup gets "mangled". I've attached a screenshot with a comparison of space and tab formatting.

Repro:
In Visual Studio 2012 (I'm using premium), create a new ASP.NET MVC 4 project (using the default web site template).
Open "Tools"->"Options"->"Text Editor"->"All Languages"->"Tabs" and set "Keep tabs" instead of "Insert spaces".
Open any view (.cshtml) and insert:
<div>
@if(true) {
}
</div>

Run format document (CTRL-E, CTRL-D).
Comments: @johnmblack - As you can tell from the bug status it is planned to be addressed in our next release. We already know how to fix the formatting when you format using Ctrl-K-D, and we are looking at the auto formatting issue as well.

Commented Issue: Razor code formatting is broken when using tabs in VS2012 MVC 4 [398]

$
0
0
When using "Keep tabs" instead of the default "Insert spaces", and running "Fomat document" (CTRL-E, CTRL-D) on in a .cshtml file with razor code any ifs inside other markup gets "mangled". I've attached a screenshot with a comparison of space and tab formatting.

Repro:
In Visual Studio 2012 (I'm using premium), create a new ASP.NET MVC 4 project (using the default web site template).
Open "Tools"->"Options"->"Text Editor"->"All Languages"->"Tabs" and set "Keep tabs" instead of "Insert spaces".
Open any view (.cshtml) and insert:
<div>
@if(true) {
}
</div>

Run format document (CTRL-E, CTRL-D).
Comments: Thank you! What is confusing for me (newbie, I admit) is how the release numbers for this particular component relate to the MVC release numbers overall -- Does "5.0 RTM" mean that this is for MVC5 ? Or is this component on its own release numbering? -John

Created Unassigned: Support Rails ActiveModel::Serializer Pattern for JSON Output on WebAPIs [1063]

$
0
0
Many client side JavaScript libraries are built off the assumption that the REST services use the [ActiveModel::Serializer pattern](https://github.com/rails-api/active_model_serializers) for JSON data. It would be nice if their were built in support for this style of API in WebAPIs so client side libraries could be used without modification on both ASP.NET WebAPI and Rails services.

Created Unassigned: [Regression]Multipart parser not setting content length header on inner contents [1064]

$
0
0
Attached a repro.

__Issue__:
The below action is returning null when actually there is valid data in the content. The issue here is that the content header ‘Content-Length’ value is 0 even though the underlying stream length is actually greater than 0…since the content-length is 0, the deserialization thinks that there is no content to be deserialized and hence returns default value for the C# type(DataPack here) which is null.
```
[HttpPost("MultipartPost")]
public async Task<DataPack> MultipartPost()
{
MultipartMemoryStreamProvider provider = await Request.Content.ReadAsMultipartAsync();

HttpContent content = provider.Contents[0];

return await content.ReadAsAsync<DataPack>();
}
```

__Workaround__:
```
[HttpPost("MultipartPost")]
public async Task<DataPack> MultipartPost()
{
MultipartMemoryStreamProvider provider = await Request.Content.ReadAsMultipartAsync();

HttpContent content = provider.Contents[0];

// workaround
Stream stream = await content.ReadAsStreamAsync();
content.Headers.ContentLength = stream.Length;

return await content.ReadAsAsync<DataPack>();
}
```

Commented Issue: Razor code formatting is broken when using tabs in VS2012 MVC 4 [398]

$
0
0
When using "Keep tabs" instead of the default "Insert spaces", and running "Fomat document" (CTRL-E, CTRL-D) on in a .cshtml file with razor code any ifs inside other markup gets "mangled". I've attached a screenshot with a comparison of space and tab formatting.

Repro:
In Visual Studio 2012 (I'm using premium), create a new ASP.NET MVC 4 project (using the default web site template).
Open "Tools"->"Options"->"Text Editor"->"All Languages"->"Tabs" and set "Keep tabs" instead of "Insert spaces".
Open any view (.cshtml) and insert:
<div>
@if(true) {
}
</div>

Run format document (CTRL-E, CTRL-D).
Comments: The bug tracking numbering is based on the MVC releases but the individual components will have the following numbering: Razor/Web Pages V3 WebApi V2 MVC V5

New Post: XMLReader throws XMLException parsing valid SOAP reply.

$
0
0
Hi,
I am completely new to ASP NET, and this is my first post, so please point me to my wrong doing and I will try to avoid mistakes in the future posts.

Now up to the problem
I use Visual Studio 2010 with NETMF SDK 4.1.
I am trying to run the simplest web service client application calling service of
www.w3schools.com/webservices/tempconvert.asmx

I run this webservice in emulator
I see that binding to service is done succesfully, I see Soap reguest going out ( through wireshark packet)
I see with wireshark that I got back valid Soap Responce (XML is valid), but framework throws exception (see blow)
Please help me to understand what goes wrong


The second problem.
I have also SDK 4.2 installed, but the same app have a trouble opening socket, terminating with SocketException, It even doesnt send TCP connect ( according to wireshark). So I conclude that emulator in 4.2 SDK does not provide net interface.


Here the trace of w3schools Convert service

Exception System.Xml.XmlException - 0xec000000 (1)

#### Message: 
#### System.Xml.XmlReader::ReadStartElement [IP: 003d] ####
#### Ws.Services.WsaAddressing.WsWsaHeader::ParseHeader [IP: 001d] ####
#### Ws.Services.Encoding.TextMessageEncodingBindingElement::OnProcessInputMessage [IP: 01e9] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.RequestChannel::ReceiveMessage [IP: 002c] ####
#### Ws.Services.Binding.RequestChannel::Request [IP: 0017] ####
#### tempuri.org.TempConvertSoapClientProxy::CelsiusToFahrenheit [IP: 0047] ####
#### MFWebClient.Service::.ctor [IP: 002d] ####
#### MFWebClient.Program::Main [IP: 0010] ####
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
#### Exception Ws.Services.Faults.WsFaultException - 0x00000000 (1) ####
#### Message: 
#### Ws.Services.WsaAddressing.WsWsaHeader::ParseHeader [IP: 01b7] ####
#### Ws.Services.Encoding.TextMessageEncodingBindingElement::OnProcessInputMessage [IP: 01e9] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.RequestChannel::ReceiveMessage [IP: 002c] ####
#### Ws.Services.Binding.RequestChannel::Request [IP: 0017] ####
#### tempuri.org.TempConvertSoapClientProxy::CelsiusToFahrenheit [IP: 0047] ####
#### MFWebClient.Service::.ctor [IP: 002d] ####
#### MFWebClient.Program::Main [IP: 0010] ####
A first chance exception of type 'Ws.Services.Faults.WsFaultException' occurred in MFWsStack.dll
An unhandled exception of type 'Ws.Services.Faults.WsFaultException' occurred in MFWsStack.dll

Created Unassigned: WebApi: Filters can't have a set execution order [1065]

$
0
0
MVC filter attributes support the Order property for setting the execution order when multiple instances are applied to a controller or method, those in Web API don't.

Created Unassigned: WebApi: Set a default formatter for requests with empty Content-Type headers [1066]

$
0
0
If the incoming HTTP request has no Content-Type header set, there's no way to set a default custom formatter which could assume some sort of a predefined default.

It should be possible to select this on a per-controller config base, so that it would be possible to have defaults for different controller groups, for instance for such URLs:

/1.0/json/<api methods>
/1.0/xml/<api methods>

Created Unassigned: WebApi: Comma in Content-Type header fails to parse anything [1067]

$
0
0
Popular iOS network library MKNetworkKit (https://github.com/MugunthKumar/MKNetworkKit) sets a Content-Type header with this value:

application/x-www-form-urlencoded; charset=utf-8,application/xml

If a comma is found in the value, ASP.NET Web Api fails to parse the entire content type and no media formatter is selected. A custom delegating handler which removes the comma and any content after it fixes the issue.

Created Unassigned: WebApi: Formatter's GetPerRequestFormatterInstance isn't used while reading [1068]

$
0
0
A formatter's GetPerRequestFormatterInstance is used only when the stream is being written (output) instead of also when it is being read. Adding this support would make it easier to support per-route specific formatters, for instance:

/1.0/<api>/ - legacy formatter
/1.0/json/<api> - JSON formatter selected by GetPerRequestFormatterInstance which matches for "/json/" in the URL

Having support for that would make it less critical for clients to set the exact Content-Type, which can sometimes be a problem.

Closed Issue: Custom attributes - underscores in name should be replaced [610]

$
0
0
When passing custom attributes to helpers via anonymous object, the "_" should be replaced with "-" just like in MVC helpers

example:

[Fact]
public void WebGridCustomHtmlAttributeIsSpecified()
{
var grid = new WebGrid(GetContext(), ajaxUpdateContainerId: "grid")
.Bind(new[]
{
new { P1 = 1, P2 = '2', P3 = "3" },
new { P1 = 4, P2 = '5', P3 = "6" }
});
var html = grid.GetHtml(htmlAttributes: new {data_attribute = "value"});
string _html = html.ToHtmlString();
Assert.Contains("data-attribute", _html);
}
Comments: Verified 0524 of Web Helper

Closed Issue: Custom htmlAttributes rendered incorrectly by WebGrid [575]

$
0
0
data_xxx attributes should be rendered as data-xxx, like other MVC Html helpers. See this StackOverflow question - http://stackoverflow.com/questions/12900138/add-custom-attributes-to-table-rendered-by-webgrid
I also raised this on Connect before realizing MVC is on CodePlex

Closed Issue: Owin Adapter should allow responses to be sent chunked [1007]

$
0
0
If a user tries to host a message handler like this with OWIN:

public class MyHandler : HttpMessageHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StreamContent(new MemoryStream(Encoding.UTF8.GetBytes("foo bar")));
response.Headers.TransferEncodingChunked = true;
return Task.FromResult<HttpResponseMessage>(response);
}
}

The response gets sent with a content-length instead of being sent chunked. We should respect the intent.
Comments: Verified.

Closed Feature: Validate the Action for correct bindability and return type [487]

$
0
0
If I am creating a bindable action for a particular entity, we need to validate the incoming request to see if the action is being applied to the correct entity type.

Example:
ExtendSupportDate is a bindable action on Product.

Following urls should work:
/.../.../Products(6)/ExtendSupportDate
/Products(6)/ExtendSupportDate

This should NOT work:
/.../.../ProductFamilies(6)/ExtendSupportDate
/.../.../Suppliers(6)/ExtendSupportDate

Also we need to validate the return type of the controller's method to the Action configuration's return type. Currently there is no validation.
Comments: Verified.

Created Unassigned: [Regression]XmlMediaTypeFormatter does not serialize Uri input correctly [1070]

$
0
0
Uri -//[07f:d:EE9e::7a:828E:C]/-861%A3+/F3&m/@pM is serialized as file://[7f:d:ee9e::7a:828e:c]/-861__%25__A3+/F3&m/@pM on server by XmlMediaTypeFormatter. This works fine when using Json formatter.

Here is my client code
HttpClient client = new HttpClient();
Uri myUri = new Uri("//[07f:d:EE9e::7a:828E:C]/-861%A3+/F3&m/@pM", UriKind.Absolute);

HttpRequestMessage request = new HttpRequestMessage()
{
Content = new ObjectContent<Uri>(myUri, new XmlMediaTypeFormatter()),
RequestUri = new Uri(baseAddress + "/My/EchoUriFromBody"),
Method = new HttpMethod("Post"),
};
var response = client.SendAsync(request).Result;
var myResult = response.Content.ReadAsAsync<Uri>(new List<MediaTypeFormatter>(){new XmlMediaTypeFormatter()}).Result;

Controller code
public class MyController : ApiController
{
[AcceptVerbs("PUT", "POST", "DELETE")]
public Task<Uri> EchoUriFromBody([FromBody]Uri input)
{
var task = Task.Factory.StartNew(() => input);
return task;
}
}
Viewing all 7925 articles
Browse latest View live


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