asp.net-mvc-5

MVC Identity 2.2.1 - Primary Key (Guid) as UniqueIdentifier instead of nVarChar(128)

馋奶兔 提交于 2019-12-24 00:42:54
问题 Current project: ASP.NET 4.5.2 MVC 5 Identity 2.2.1 One of the problems I am running into is that I am making use of GUIDs properly throughout the rest of the project, with the DB field types being UniqueIdentifier. Unfortunately, Identity does not play by the same rules, and for some inscrutable reason they created the table fields as a string -- nVarChar(128). I have found a few hits out there that show how to properly modify Identity to use UniqueIdentifier and cast the Guids to the proper

404 Page works on localhost but not on production (Azure Web App)

这一生的挚爱 提交于 2019-12-24 00:15:09
问题 I have a 404 page on my localhost which works just fine. However, when it's pushed to Azure Web App, it does not. I pushed it originally through the Publish tool, and right now I use the built in feature that pushes from a branch in Github. I have the following web.config : <system.web> <customErrors mode="On" defaultRedirect="~/Error/Index"> <error redirect="~/Error/NotFound" statusCode="404" /> <error redirect="~/Error/Index" statusCode="500" /> </customErrors> <!-- More stuff :-) --> <

Gaps at the top and side of navigation bar buttons

半城伤御伤魂 提交于 2019-12-23 23:04:41
问题 I'm creating a website and have run into a minor but incredibly infuriating problem. I'm creating a Navigation bar and the buttons of the navigation bar have a gap between the far left, and top of the screen. In other words, all buttons have a gap from the top and the leftmost button has a gap from the left of the screen. The relevant parts of my Stylesheet are shown below. body { margin: 0px; padding: 0px; font-family: Arial; } .navbar_base { width: 100%; overflow: hidden; background-color:

MVC Url.Content with javascript local variable

拥有回忆 提交于 2019-12-23 22:51:59
问题 I have problem with this: var id=5; var el = $("MainPhotoHolder"); el.attr("src", '@Url.Content("~/Page/GetImage/" + id)'); id is a local javascript variable, but it gives me an error saying that is not in the context. My question is how do i point out that it should be a javascript variable and not a c# one ...? 回答1: You cannot mix JavaScript and Razor in this way. Razor does not have any reference to it so it cannot use it to generate your link. Try this: el.attr("src", '@Url.Content("~

How to truncate time part from date in linq query?

那年仲夏 提交于 2019-12-23 20:29:26
问题 Hi I am trying to write linq query to get some details from Sql table. I have created column and storing date and time both. while returning i want to ommit time part. May I know is this possible? List<returnObject> obj = new List<returnObject>(); obj = (from c in objectDB.NCT_Project join user in objectDB.NCT_UserRegistration on c.adminUserId equals user.User_Id where c.adminUserId == userId select new returnObject { id = c.project_Id, key = c.key, created = c.createdDate //currently returns

Multiple Image File Upload with Captions

早过忘川 提交于 2019-12-23 18:39:28
问题 I managed to get the captions by foreach loop but now I'm facing a new problem. I get duplicates in my database because of the nested loop, please check the code below. JavaScript window.onload = function () { if (window.File && window.FileList && window.FileReader) { var filesInput = document.getElementById("galleryFilesAdd"); filesInput.addEventListener("change", function (event) { var files = event.target.files; //FileList object var output = document.getElementById("result"); for (var i =

Default MVC5 Application will not run out of debug mode in browser VS Express 2013

我与影子孤独终老i 提交于 2019-12-23 15:40:04
问题 I have just started to develop an application in Visual Studio 2013 using MVC5. I am using the default MVC application, I have made no changes. I find that running the application works fine while in debug mode however if I Stop Debugging Shift F5 and change from on page to another or refresh my application in the browser I find that the connection to the localhost server is disconnected. I get a message Firefox can't establish a connection to the server at localhost: I have tested another

What is the recommended way to run asp.net identity functions in transaction?

一世执手 提交于 2019-12-23 15:26:30
问题 Using asp.net identity RTW version. I need to perform several actions in a transaction, including both UserMananger function calls and other operations on my DbContext (example: create new user, add it to group and perform some business-logic operations). How should I do this? My thoughts follow. TransactionScope using (var scope = new TransactionScope(TransactionScopeOption.Required)) { // Do what I need if (everythingIsOk) scope.Complete(); } The problem is: UserManager functions are all

Efficient caching of Identity related entities

北慕城南 提交于 2019-12-23 15:22:42
问题 I'm using asp.net MVC5 and asp.net Identity v2 (from the nightly releases) but I think this question still applies to Identity V1. I have a membership system and i am linking a AspNetUser entity to my membershipuser entity via a field AspUserId in the membershipuser table. public partial class membershipuser { public int id { get; set; } public string full_name { get; set; } public string address { get; set; } public string AspNetUserId { get; set; } ..... } I was wondering what is the best

Could not load type 'System.Data.Entity.DbSetExtensions' from assembly 'EntityFramework

大兔子大兔子 提交于 2019-12-23 14:54:44
问题 Updated from entityframework 6.0.0-beta1 to 6.0.0-rc1 and when logging into my MVC5 application i get the following error {"Could not load type 'System.Data.Entity.DbSetExtensions' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.":"System.Data.Entity.DbSetExtensions"} [System.TypeLoadException]: {"Could not load type 'System.Data.Entity.DbSetExtensions' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken