Problem with converting int to string in Linq to entities

var items = from c in contacts select new ListItem { Value = c.ContactId, //Cannot implicitly convert type ‘int’ (ContactId) to ‘string’ (Value). Text = c.Name }; var items = from c in contacts select new ListItem { Value = c.ContactId.ToString(), //Throws exception: ToString is not supported in linq to entities. Text = c.Name }; … Read more

Difference between and ?

Every time I have to add a handler or module for ASP.NET with IIS7, the instructions always tell me to incorporate it into two sections: system.web and system.webserver. <system.web> <httpHandlers> </httpHandlers> <httpModules> </httpModules> </system.web> And this: <system.webServer> <modules> </modules> <handlers> </handlers> </system.webServer> What is the difference between these two sections? In addition, if I don’t … Read more

What is the claims in ASP .NET Identity

Can somebody please explain, what the claim mechanism means in new ASP.NET Identity Core? As I can see, there is an AspNetUserLogins table, which contains UserId, LoginProvider and ProviderKey. But, I still can’t understand or find any information on when data is added to the AspNetUserClaims table and what situations this table is used for? … Read more

DropDownList’s SelectedIndexChanged event not firing

I have a DropDownList object in my web page. When I click on it and select a different value, nothing happens, even though I have a function wired up to the SelectedIndexChanged event. First, the actual object’s HTML code: <asp:DropDownList ID=”logList” runat=”server” onselectedindexchanged=”itemSelected”> </asp:DropDownList> And this is that function, itemSelected: protected void itemSelected(object sender, EventArgs … Read more

Unable to launch the IIS Express Web server, Failed to register URL, Access is denied

Some web projects are causing me problems while others work fine. I decided to focus on one of the problematic ones. I’m using Visual Studio 2013 on Windows 7. I think I’m running it as administrator, the window title says PROJECT NAME – Microsoft Visual Studio (Administrator). When I try to run the project I … Read more

Do I need a Global.asax.cs file at all if I’m using an OWIN Startup.cs class and move all configuration there?

Let’s say for example in a brand new ASP.NET MVC 5 application made from the MVC with Individual Accounts template, if I delete the Global.asax.cs class and move it’s configuration code to Startup.cs Configuration() method as follow, what are the downsides? public partial class Startup { public void Configuration(IAppBuilder app) { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); … Read more