asp.net-mvc-5

System.Data.DataException: An exception occured while initializing the database

ぃ、小莉子 提交于 2019-12-14 04:20:08
问题 Please help me on this. I have written a code for getting the first record from the database using LINQ My Homecontroler [CustomHandleError] public class HomeController : Controller { Domain domain; public HomeController() { domain = new Domain(); } public ActionResult Index() { HomePageViewModel vm = new HomePageViewModel(); vm.Page = domain.GetHomePageInfo(); if (vm.Page != null) { ViewBag.Title = vm.Page.PageTitle; ViewBag.Keywords = vm.Page.PageKeywords; ViewBag.Description = vm.Page

How to pass username after login redirect?

邮差的信 提交于 2019-12-14 04:20:06
问题 I have 2 applications: one does the login ( app1 ) and another one does other stuff that I want ( app2 ). The app1 is built in ASP.NET Boilerplate and what I want to do is after login with this app, I want to redirect to the app2 . Until now everything is fine, I just used the returnUrl parameter to redirect to the app2 . The problem is that I want to pass to app2 some of the login information like username . It's not supposed to change anything in app1 , so how can I do that? Both app1 and

Using Both of Attribute and Convention Routing

て烟熏妆下的殇ゞ 提交于 2019-12-14 03:56:40
问题 Is there a way to use Convention and Attribute Routing together? I want to call an action method with the real name of method and controller when I defined the attribute routing. The mapping method is calling at startup: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapMvcAttributeRoutes();/// routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id =

Cannot open the edit popup of kendo grid using jquery

本秂侑毒 提交于 2019-12-14 03:45:32
问题 I am implementing a context menu for my kendo grid on MVC page. I am trying to call the edit button on my kendo grid using on click of the context menu. I have implemented event on my context menu and on the event written jquery code to call fire the click event of the edit button. I do see the window popping up for a split second and closing. How do I get this working @(Html.Kendo().ContextMenu() .Name("menu") .Target("#GridTeam") .Filter("tr") .Orientation(ContextMenuOrientation.Vertical)

RouteAttribute broke my Default route

旧城冷巷雨未停 提交于 2019-12-14 03:35:04
问题 If I apply [Route(Name = "WhatEver")] to action, which I use as Default site route, I get HTTP 404 when accesing site root. For example: Create new sample MVC project. Add attributes routing: // file: App_Start/RouteConfig.cs public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapMvcAttributeRoutes(); // Add this line routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new {

Is Razor compulsory in ASP.NET MVC 5? [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-14 03:20:04
问题 This question already has answers here : Using ASPX View Engine with MVC 5 (2 answers) Closed 4 years ago . I am new to ASP.Net MVC 5 and I want to know if Razor view engine is compulsory, or can you use ASPX view engine? I try to create new application but I am not getting option to change the view engine. 回答1: Razor views are not compulsory. You can use aspx views. When creating your project there is a dropdown that allows you to select which view engine you want the template to use, if you

Invalid length for a Base-64 char array or string. in UserManager.CheckPasswordAsync(user, password)

烈酒焚心 提交于 2019-12-14 03:17:24
问题 I'm learning MVC and for creating Login and Register with Custom Existing Database I followed this tutorial and created custom User Manager and Sign In Manager. It allowed me to register a user properly and users are saved in my db properly. But password is saved as string without encryption as user entered it and also while login CheckPasswordAsync returns System.FormatException: Invalid length for a Base-64 char array or string. For Implementing UserPasswordStore I followed this tutorial

how to send email in Asp.net mvc 5 [duplicate]

南楼画角 提交于 2019-12-14 03:02:50
问题 This question already has answers here : Sending email in .NET through Gmail (23 answers) Closed 4 months ago . What code should I use to send email in C#? I tried to find a specific code so that I could send an email from my website. And then I get an error: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at" public void sendEmail(string toEmail, string subject, string emailBody) { string

Accessing logged in user Id from class - MVC 5, AutoMapper and Identity 2.0

心已入冬 提交于 2019-12-14 02:34:03
问题 So In my project have implemented interfaces and AutoMapper, and Identity 2.0 with Id as int modification form here: http://typecastexception.com/post/2014/07/13/ASPNET-Identity-20-Extending-Identity-Models-and-Using-Integer-Keys-Instead-of-Strings.aspx Question is how to access ApplicationUserManager properties from: public class EnteredByResolver : ValueResolver<ExcursionVM, int> { protected override int ResolveCore(ExcursionVM source) { return 1; // TODO - need to access loged user Id to

excluding folders from Visual Studio 2015 publication

☆樱花仙子☆ 提交于 2019-12-14 02:20:24
问题 I need to exclude folders media, umbraco and umbraco_client from the publication of the project. These folders are rarely changed and I do not want to wait each time until they are copied during the publication on the FTP server. Here is my config local.pubxml: <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <WebPublishMethod>FileSystem</WebPublishMethod> <LastUsedBuildConfiguration>Release<