asp.net-4.5

Upgrading from ASP.NET MVC 3 to ASP.NET MVC 4 leads to 404 errors

ε祈祈猫儿з 提交于 2019-12-11 15:03:48
问题 I just upgraded ASP.NET MVC 3 to ASP.NET MVC 4 with .NET 4.5 and root controllers were working but controllers in MVC Area started giving 404 errors. I looked up for IIS 7 QFE patch, but it is not applicable to windows 8. By setting breakpoints, I could see that area was registered successfully and also after complete registration, I see 4 routes registered in routes collection and first one is the route corresponding to area. But any request for area url just falls to 404 error. 回答1: I am

Custom WCF Landing Page when Hosted in IIS 7.5

柔情痞子 提交于 2019-12-11 03:33:50
问题 I have read through what seems to be available on the internet for replacing the standard WCF landing page with a custom site, however, these solutions seem not to apply to IIS hosting. Both this question and this walkthrough suggest creating an unmatched message handler and disabling metadata publishing. However, the comments for both suggest that it doesnt work when hosted in IIS and I can confirm this appears to be the case. Is there a step missing that IIS requires? Something that needs

RegisterClientScriptResource NullReferenceException in a Child IIS Application

烂漫一生 提交于 2019-12-11 03:32:27
问题 I upgraded from .Net 4.5 Beta to the RTM version, and now when I have a standard WebForm page where I had a generic <asp:RequiredFieldValidator /> tag I get a NullReferenceException that looks like this: [NullReferenceException: Object reference not set to an instance of an object.] System.Web.UI.WebControls.ValidatorCompatibilityHelper.RegisterClientScriptResource(Control control, String resourceName) +180 System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +253 System.Web.UI

Web Api 2: [Required] for value types?

别等时光非礼了梦想. 提交于 2019-12-10 19:31:04
问题 Using the [Required] data annotation in Web Api input models only seems to check for reference types being instantiated to null: public class MyInputModel { [Required] // This works! ModelState fails. public CustomClass MyCustomProperty { get; set; } } How can we get this to work with value types WITHOUT the default instantiation? public class MyInputModel { [Required] // This is ignored because MyDouble is defaulted to 0 public double MyDouble { get; set; } } Is the only way through using

The cast to value type 'DateTime' failed because the materialized value is null

泪湿孤枕 提交于 2019-12-10 15:39:11
问题 My project is the throwing the above error because the Ship Date in my table is null. I am using Code First, and the DateTime field is declared as nullable both in the generic set and the SQL table. I am populating a gridview with the result set. Ideally, I would like to have the gridview display "not yet shipped" when the ShipDate field is null, but at this point, I would be happy just to be able to display the record. Any help is greatly appreciated. Here is the code-behind and the context

How to detect IIS Express version?

一曲冷凌霜 提交于 2019-12-10 12:28:21
问题 I have found that our ASP.NET application runs differently on different machines in IIS Express. All have VS 2012, .Net 4.5 and Integrated mode. But some has VS 2012 Update 1, some not. How do I find IIS Express version? 回答1: Browse to "C:\Program Files\IIS Express" , select the file iisexpress.exe , press Alt+Enter to open the properties dialog, click on the Details tab and read the product version. 回答2: HttpRuntime.IISVersion will give you the major and minor version of IIS (e.g., 8.0 ).

handling null datetime in gridview

余生长醉 提交于 2019-12-10 10:55:03
问题 I have a gridview in C# asp.net Web 4.5 Framework that works great until a null valued is passed for a field I am formatting as a date.. here is my template field <asp:templatefield> <HeaderTemplate> <asp:Label ID="lblHeadEmailFirstSendDate" runat="server" Text="1st Email<br />Target Date"></asp:Label> </HeaderTemplate> <ItemTemplate> <asp:Label ID="lblEmailFirstSendDate" runat="server" Text='<%# Convert.ToDateTime(Eval("EmailTargetFirstSendDate")).ToString("MM/dd/yyyy")%>'></asp:Label> <

Is MVC4 baked into .NET 4.5?

旧街凉风 提交于 2019-12-09 07:51:49
问题 A lot of release notes for Visual Studio 2012 talk about .NET 4.5 and MVC4, but I can't tell if MVC4 is actually part of the .NET 4.5 release. Anybody know for sure? I would love not to have to install MVC separately on my server. 回答1: No, ASP.NET MVC 4 is baked into VS2012, exactly the same way ASP.NET MVC 3 was baked into VS2010 but not part of .NET 4.0 (there was a separate download that you could install on your servers). But there will also be a separate download of ASP.NET MVC 4 for

Strongly typed data binding and generics?

*爱你&永不变心* 提交于 2019-12-09 05:37:56
问题 Suppose I want to bind a generic type (here: Dictionary<string, string> ) to a Repeater using the new ASP.NET 4.5 strongly typed data binding. Then I would have to put down KeyValuePair<string, string> as the ItemType Property of the Repeater. <asp:Repeater id="rpCategories" runat="server" ItemType="System.Collections.Generic.KeyValuePair<string, string>"> There is an obvious problem here: I can not use < or > within the ItemType text! How would one go about this? Is the use of generics

Is it possible to pass a value to the SelectMethod of a Repeater?

那年仲夏 提交于 2019-12-09 05:19:59
问题 ASP.Net 4.5 introduces new ways to bind data to controls like the Repeater through the SelectMethod property: <asp:Repeater runat="server" ItemType="MyData.Reference" SelectMethod="GetReferences"> calls the Codebehind method public IEnumerable<Reference> GetReferences() In the scenario of nested repeaters, is it possible to pass a parameter to this select method somehow, so that it fetches different data depending on the Item of the outer repeater? Example: <asp:Repeater runat="server"