« first day (1822 days earlier)      last day (3125 days later) » 

12:06 AM
0
Q: How to login with "UserName" instead of "Email" in MVC Identity?

Kevin MaxwellI need to set my login to use username instead of email address, how can I change it?

 
3
Q: Configure AspNet.Identity to allow for either username OR email address on login

aaronmallenI am wondering if there is a more efficient route to take here. Using AspNet.Identity I would like to allow the user to sign in to the same text box using either their UserName or Email. I went ahead and addressed this issue in the AccountController Login ActionResult. I run the check before c...

 
1:11 AM
@SeventhSon thanks buddy, I know about those pages but the problem is when I try any of them I get red underline for model.UserName. Even when I type model. I don't see any UserName.
 
 
3 hours later…
4:01 AM
 
 
2 hours later…
6:25 AM
Good morning :)
 
hello guys
in order to create a program like ccleaner which language would you think is better to use ?
1) C# 2) VB.NET 3) WPF ( Windows Presentation Foundation )
 
there is no difernce in real functionality between c# and vb.net
and WPF isnt a language
 
so in wpf we use c# ?
c# i think is more portable for other operation systems
 
c#, vb.net, and F# all sit on top of the .net framework
wpf is part of the .net framework
@gtzinos c# and vb.net are both supported by mono last i checked
 
6:41 AM
@Alex i didnt know it. i know that this support only c#. So for program like ccleaner which language would you prefer ?
 
@gtzinos You work in what your comfortable in or what or team/job requires of you.
 
@Alex We will try to start a project using a new for us language. So we need to know which of them is better for a program like this.
 
@gtzinos The point im getting at is there is no better language in the choices you gave. C#'s general support may be a tad better in my general experience but nothing to the point where it could make it a better language. In short its personal preferance.
 
@Alex Hmm i will take a look thank you. You will prefer 1) c# windows form 2) c# wpf ?
 
Depends what I am doing, I prefer WPF for most things
 
7:12 AM
@gtzinos It honestly doesn't matter what you use. Whatever is comfortable for you and your team. For new projects in .NET world, C# and WPF are recommended, though, so if you want to get some semi-relevant skills, use that.
@gtzinos That said, if you are talking about portability, C# portability is dodgy at best, and WPF cannot be ported at all. Please consider that before you make an educated decision.
 
Apache Cordova or simlar might be a better idea if cross plat is a huge concern, but bare in mind most of an app like CCleaner's functions are OS spacific so its not like you will be reusing much code
 
Electron with os-specific triggers would be my bet. :P
 
0
Q: How to login with "UserName" instead of "Email" in MVC Identity?

Kevin MaxwellI need to set my login to use username instead of email address, how can I change it?

 
7:28 AM
the answer you have is correct
 
@Alex I know it's correct but it doesn't work for me.
@Alex the problem is when I try any of them I get red underline for model.UserName. Even when I type model. I don't see any UserName.
 
8:08 AM
Anyone here have experience with image proccessing of vector graphics in c#?
I'm looking for a library that will allow me to take a set of points repressenting a polygon and turn that then first add several of these into a single shape (unless they don't overlap), then substract some spaces then erode them see if any have become detached and then dialate them again.
 
We need to make a program like ccleaner ( Gui and the functionality ) and i need to know if its better to use 1) c#/vb windows form 2) c#/vb windows presentation foundation
@RoelvanUden thanks
 
8:27 AM
@gtzinos And it's cross platform too?
 
@RoelvanUden If not ?
 
but is it?
 
@gtzinos If not, C#+WPF is a great choice. If it is.. it's not a great choice.
 
@RoelvanUden if it is what you prefer ?
 
@gtzinos No, but it is the recommended desktop tech from MS.
 
8:41 AM
@RoelvanUden So if we need to make a portable app you recommend VB windows form or C# windows form ?
 
@gtzinos No. I would recommend TypeScript/Electron.
@gtzinos C#/VB aren't exactly portable-friendly.
@gtzinos But if you must use C# or VB, use C#.
@gtzinos And write the logic detached from the GUI and implement the GUI on each platform you target. WPF for Windows, GTK# for Linux, Cocoa for Mac.
 
if we dont need to have a portable app you reccoment 1) TypeScript 2) Electron 3) C# ?
 
Can you please just read what I wrote?
C#+WPF is the recommended MS tech for desktop applications.
Would I personally use it? No. But I'm not you and our goals/experiences are different.
 
@RoelvanUden have you worked with Electron much? It looks pretty neat...
 
@Squiggle Not much, I mostly have experience with nwjs, but Electron is a logical step up in the right direction. Besides, Atom and VSCode both use it. :)
1 message moved to Trash can
@KevinMaxwell Please don't spam your question :-)
 
8:53 AM
@RoelvanUden Then please help me with a solution.
 
@KevinMaxwell can you at least explain what you've tried already, and what didn't work?
@KevinMaxwell Your SO question already has a link to a duplicate question with an answer. Is that insufficient?
 
@Squiggle as you see on that page there is one answer which I believe it's the correct one but the problem is when I try the same thing I get a red underline for model.UserName and even when I type model. I don't have any option for UserName.
@Squiggle before asking the question I checked all of those answers but they didn't help me.
 
@RoelvanUden I have always found that a bit odd, they go and add a bunch of stuff for Apache Cordova into VS and then code CSCode in electron, i asume it is because Cordova has better mobile support
 
@Alex Cordova and Electron have two different objectives.
@Alex Cordova is mobile-orientated, for iOS/Android/WP
@Alex OTOH Electron is desktop-orientated, for Linux/Windows/Mac
So write your code robust enough and it can run on both, thus, everywhere.
 
@KevinMaxwell what's the class name of your model?
 
8:59 AM
IdentityModels
@Squiggle Do you want me to drop my model class here?
@Squiggle using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;

namespace Project_APP_MVC.Models
{
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit go.microsoft.com/fw
 
use pastie.org @KevinMaxwell its cleaner for the chat
 
@RoelvanUden Ah that makes more sense, i didnt notice that Cordova only runs on Windows as a App store Application, i asumed it just ran normaly.
 
@Alex They are working on it AFAIK but it's nowhere near complete. OOTH Elecrron is just WebKit+NodeJS so it can anything, and for that reason, is really powerful.
 
@KevinMaxwell I cant see any real problem ApplicationUser is the model in question and it extends IdentityUser and IdentityUser has a username
 
@GotaloveCode sorry, I didn't know it. I will use it in the future.
 
9:07 AM
no problem.
 
@Alex that's exactly what makes me crazy which I don't see any problem.
 
@KevinMaxwell even though you get the red underline, does it compile?
occasionally VS screws up like that
also IdentityUser.UserName is virtual. You could always override it - that shouldn't change the behaviour, and it might make it compile? :P
 
@Squiggle no, I can't compile or build it. It shows an error message.
@Squiggle
Error CS1061 'LoginViewModel' does not contain a definition for 'UserName' and no extension method 'UserName' accepting a first argument of type 'LoginViewModel' could be found (are you missing a using directive or an assembly reference?)
 
Did you learn about programming 101 before you set out to build something?
 
9:27 AM
@KevinMaxwell LoginViewModel is not the class you just posted. Try updating your view model with the appropriate property, and plugging that in properly.
hah. FIFA have been advertising for a C# dev on SO for about 8 months now.
 
9:45 AM
@Squiggle that class was already created by Identity so it was not written by me.
 
but you can alter it, right?
the code which was generated assumed that the Email would be the identifier.
 
@Squiggle yeah you can, its not even part of identity its just something made by the template
 
then have at it! :D
 
@Squiggle When I change public async Task<ActionResult> Login(LoginViewModel model, string returnUrl) to public async Task<ActionResult> Login(ApplicationUser model, string returnUrl) I get the UserName with model.UserName but then I get error for model.password and model.RememberMe
@Squiggle I've been able to do the same thing with WebForm but no luck with MVC
 
good morning peeps
coudl anyone tell me the best way to get the actual error message when its nested down rather than me printing see inner exception details
 
10:02 AM
@KevinMaxwell check if this is what you been looking for stackoverflow.com/questions/27501533/…
 
@KevinMaxwell wat. Don't replace the view model with the domain model! Just add a property to the ViewModel and ensure that is respected elsewhere in the system!
 
oh why didnt i realise exception.ToString() does this for me,
lol
 
@codebrain didn't help.
@Squiggle I like your approach the most but honestly I don't know how to do that without screwing other parts. :(
 
10:17 AM
@KevinMaxwell I'm not entirely sure why it's so difficult to add a property to a view model. What exactly does this break?
 
10:34 AM
I seriously hate data replication via batch jobs.
I've seen a couple of services which rely on data from other systems, such that A -> B, B -> C and C -> A.
All dependent data is copied from the dependent database at regular intervals.
which means one typo gets synchronised across the entire application suite and is almost impossible to fix
 
hehe
these things always start with someone saying "I have a cunning plan"
at least that's how I imagine it
 
I saw that once in a loan application - it took them 3 years to spell my name correctly, because every 3 months it would revert to the original typo.
@StevenLiekens it happens here because all work has historically been project-based, and nobody ever stops to consider the bigger picture.
 
sounds like every corporation, ever
except in organised crime
 
hire a contractor for 2 months, get them to bodge the functionality. It looks like it works, they leave - and then 4 years later ol' munchkin here is tasked with figuring out why Mindy Foo's surname wasn't updated in the HR system after she married Gary Bar.
 
and fix it?
 
10:47 AM
o/
\o
 
hah. It took us 18 months to convince the business that it needed fixing in the first place. We're still only half way through integrating the systems properly.
on the plus side, it means everything is more-or-less realtime. This next deployment is speeding up some business processes from 5 days to 5 minutes.
o/ @Sippy
i r bizniz integrat0r!
 
has anyone ever come across issues with azure vms not allowing Post from HttpClient?
 
ok cool i'll do some more debugging, i thought it may be a setting in it, as its working fine on my local system and on a dev server.
when its deployed to the staging server (which is sitting behind a load balancer if that makes a difference?) its not passing it across
 
11:23 AM
hey ? anybody online ? I need help, sir and madam. I am newbie in .net programming
 
@SuperPruuylan hello sir and/or madam!
@SuperPruuylan what's up?
 
Hey guys, did anyone experience the problem, that you get a runtime exception saying "could not load assembly..." but the assembly showed up in the loaded modules? The referenced assembly does not have any other referenced assemblies (but .Net assemblies)
 
11:48 AM
@Squiggle hey sir
@Squiggle I have questions
@Squiggle regarding C#, .NET and datagridview
 
12:00 PM
@SuperPruuylan Just ask your question.
 
@SuperPruuylan frequent questions on datagridview are already answered on SO. Please research on finding answers if already exists.
 
Anyone here have experience with the clipper polygon library?
 
who farted?
 
Do you know something about clipper?
 
@StevenLiekens Eeuh.. wut?
 
12:14 PM
@StevenLiekens that was me. Sry.
 
Does anyone know how to call method on KeyDown for Windows 8 App?
private void RestartGame(object sender, KeyRoutedEventArgs e)
{
    if (e.Key == Windows.System.VirtualKey.Escape)
    {
        this.Frame.Navigate(typeof(MainPage));
    }
}
I tried doing this but it doesn't work, however. Pressing escape does nothing at all.
 
Does it get called?
 
Yep. I added an event handler on the page root like this:
<Page
   x:Name="pageRoot"
   x:Class="CYBOracleProject.Chapter1_1"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:local="using:CYBOracleProject"
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
   mc:Ignorable="d" Tapped="NxtDialog" IsDoubleTapEnabled="False"
   IsRightTapEnabled="False" IsHoldingEnabled="False" KeyDown="RestartGame">
Though I'm not really sure if I called the method right...
Can someone help me on this?
 
12:31 PM
Hey guys, I'm having a problem adding a user to a role in ASP.NET Identity, using MVC
I can create a user fine, but when I call AddToRole, my code throws the following exception; The specified cast from a materialized 'System.Int32' type to the 'System.String' type is not valid.
public ActionResult CreateDealer(RegisterDealerViewModel model)
{
if (!ModelState.IsValid)
{
return View("Index");
}
else
{
var newDealer = new ApplicationUser { UserName = model.Name, Email = model.Email };
var IsDealerCreated = UserManager.Create(newDealer, model.Password);

if (IsDealerCreated.Succeeded)
{
UserManager.SetLockoutEnabled(newDealer.Id, true);


if (UserManager.AddToRole(newDealer.Id, Convert.ToString("superuser")).Succeeded)
{

Service.CreateNewDealer(model.Name, model.Address1, model.Address2, model.Address3,
that's my current code, does anyone know what that exception means?
 
Yay unformatted code
 
Convert.ToString("superuser") <--this does nothing
 
public ActionResult CreateDealer(RegisterDealerViewModel model)
{
if (!ModelState.IsValid)
{
return View("Index");
}
else
{
var newDealer = new ApplicationUser { UserName = model.Name, Email = model.Email };
var IsDealerCreated = UserManager.Create(newDealer, model.Password);

if (IsDealerCreated.Succeeded)
{
UserManager.SetLockoutEnabled(newDealer.Id, true);


if (UserManager.AddToRole(newDealer.Id, Convert.ToString("superuser")).Succeeded)
{

Service.CreateNewDealer(model.Name, model.Address1, model.Address2, model.Address3,
i fixed that shit
 
No you didn't
 
STOP PASTING CODE
 
12:33 PM
Lol
 
lol thanks =P
 
not the code, but the formatting shit
 
You didn't fix it.
 
use a dotnetfiddle or pastebin
 
It has no indentation.
 
12:33 PM
Okay, can you help me solve my question?
 
dat segway
 
@ReeceCottam perhaps a stack trace might be more useful
 
@squiggle here's the stack trace pastebin.com/g2yiM0dn
 
@ReeceCottam that's a stack trace of a database error. You sure that's the relevant error here?
ah yep sorry - it is a database error
I think your db schema and the expected value are of different types.
 
hmm...that's weird
 
12:41 PM
it's difficult to tell!
 
well on my roles table in the DB I have the Role ID which is an Int, and Name, which is an nvarchar(256)
 
in your UserManager.AddToRole you're doing something in Linq/SQL, correct?
is UserManager your own class? or is that a framework class?
 
no UserManager is part of Identity
It's supposed to add a user to a role, so I've passed it the GUID that identity generated for that user
and also the string value of the role I want to add it to
it uses EF to connect to the Database aFAIK
 
looks like UserManager is expecting a string primary key, not an int.
*googlegooglegoogle*
 
Haha sorry, I'm just checking that out now
 
12:48 PM
looks like the most recent relevant info
does that look applicable? I'm flying blind here - I work on intranet apps and haven't touched ASP.Net user management for a few years
FWIW I wouldn't recommend you tear up your codebase until you're sure what the problem is
:)
God knows why it defaults to a string pk, though. Does it still try to use GUIDs?
 
Yeah that's exactly what it does
and it is already a string, the ID
 
aha
 
For that reason, so I'm unsure as to where it's getting that int from
 
but you're passing in an int, right?
 
oh no sorry
let me clarify
 
12:52 PM
UserManager.AddToRole(newDealer.Id ...
is .Id a string?
 
yeah, that's actually the GUID
 
aha
(also, ewww)
 
newDealer.ID is the primary key,which is a string GUID hahaha
I don't like it either to be honest, but I have to work with it
 
fair enough!
last time I used this I implemented my own membership provider
 
The funny thing is, everything else works but this!
Identity's pretty good usually
 
12:56 PM
I can see how that could be annoying
aye it's not bad - especially for out-of-the-box functionality
 
hmm...I wonder why it's trying to cast an int to a string...when that method takes only 2 string type arguments
 
something is stored as an int, and it's trying to read it as a string
    public virtual Task AddToRoleAsync(TUser user, string roleName) {
        ThrowIfDisposed();
        if (user == null) {
            throw new ArgumentNullException("user");
        }
        if (String.IsNullOrWhiteSpace(roleName)) {
            throw new ArgumentException(IdentityResources.ValueCannotBeNullOrEmpty, "roleName");
        }
        var roleEntity = _roleStore.DbEntitySet.SingleOrDefault(r => r.Name.ToUpper() == roleName.ToUpper());
        if (roleEntity == null) {
            throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, IdentityResources
 
oh my god
 
sorry for the codepaste - that's from symbolsource.org - looks like the method that's erroring. It queries the Role store
 
you'll never guess what it is
 
1:02 PM
hah what
 
I've been a stupid twat and changed the datatype from nvarchar to int when I set up the DB!
 
Convert.ToString("superuser")?
haha
 
Not realising you need the guid on the aspnetusersroles table!
why I don't know
 
Nice.
Lol
 
urgh. A girl just walked through the office and now it smells of perfume :x
 
1:04 PM
@Squiggle Why is that urgh
Damn grills
 
GRILL GRILL GRILL??!!
 
GRRRRRRRRRRRIIIIIIILLLLLLLLLLLLLLLLLLL?
 
Spicy grills :9
@Sippy really fucking strong perfume and now I can't stop sneezing.
 
@Squiggle Hahahaha
waves fist at grills
@Squiggle What is :9 supposed to be
 
long nose maybe
 
1:09 PM
grills? like bear grills? =P
 
GRILL!?
@Loetn kappa.
 
le grille!? what the hell's that!?
 
No one understands me like you @Loetn
wutface
 
Ahahah, I was wondering what the 'ping' noise was that I was hearing.
Apparently chat enabled sound :P
@Sippy Understanding grills is hard
 
1:16 PM
private Queue<char> s;
+1 for verbose variable naming
 
Both of these will be flown for the first time together by the end of the decade, and in the 2020s, NASA plans to capture an asteroid and have astronauts go and visit it in cislunar space (between Earth and the Moon).
just sounds like a bad idea lol
 
@SteveG Sounds like a terrible idea
Let's do it!
We as a race have bigger things to worry about man seriously.
 
capture means what?
 
i'm surprised Kendall didn't bite on this topic
 
Put a flag on it.
Is he here?
 
1:21 PM
i thought he's 7/24 here
except those days he was in Gilgistan something
 
@SteveG asteroid escapes, runs amok
 
well, lol
thats one of my concerns, you know, a little mistake (like converting between standard and metric) and that puppy would knock us out
 
@tweray lol
 
on top of that, i wonder the chances of that actually screwing with our tides and stuff
 
discovers its humanity in a moving reunion with the well-meaning but easily led scientist who discovered it
 
1:24 PM
Lol
 
see, i told u
 
pls
@tweray 7/24?
 
@SteveG It works in Kerbal Space Program!â„¢
 
lol
 
@Sippy 7 days a week, 24 hours a day
 
1:26 PM
Never seen anyone say 7/24 instead of 24/7.
Are you a hipster?
 
lol
 
and apparently we don't need to worry about an asteroid hitting us. They pop like balloons:
 
@Sippy dude, you are messing with half of United states
 
Lol
@tweray Pretty sure Americans say 24/7
Pretty sure they came up with the saying.
I don't live there though so vOv
 
of course, americans come up with everything
;)
 
1:29 PM
That doesn't necessitate that everything is intelligent :P
 
lol
I refuse to acknowledge that republicans come from america
 
I refuse to acknowledge republicans
 
damn, i wish i wasn't sick as a dog, this cough is killing me
 
america is all republicans to a canadian
 
@Sippy licking lips emote :9
 
1:34 PM
Isn't that :p?
 
no that's a raspberry
 
@KendallFrey was in victoria last week, and your election ads just make me feel much better
I was like "thank god US is not the only stupid country on the earth"
 
yeah lol
NDP ads make me giggle
"We're ready for change"
ORIGINAL-ASS MOFOS AREN'T YOU
 
@Squiggle You're a raspberry, motherfucker
ffs I'm gonna have to go to the god damn dentist.
 
very ragey chat today
 
1:42 PM
Dentist are not the tax man
 
that's what we call MONDAY
 
holiday monday fuck yea
 
w8.... your thanksgiving is today?
 
@ton.yeung are you using something like that forms generator for ng?
 
@tweray aye
 
1:48 PM
@KendallFrey fuck u, get out of my raging monday
 
dolla dolla bill yall
 
@Sippy who even uses dolla bills anymore
oh wait
 
dolla dolla bill users
aka gangsta g's
 
the same people that use pennies
 
wutface
 
1:56 PM
and can't think of a good way to distinguish between denominations at a glance
 
@Sippy you are going to dentist not tobacco shop right?
 
2:23 PM
@tweray wat
I'm not going to no dentist
It'll sort itself out.
 
it probably won't :)
 
u know, some scotch and a small hammer may help
 
@Squiggle If it doesn't I'll go to the dentist ;D
 
2:39 PM
Can I localize a placeholder for a Kendo textfield?
nvm got it :)
 
Kendo :(
 
Lol
 
Kendon't
 
^
no kendo that
 
In IE developer tools, is there a way to view all the js events of your page executed?
 
2:57 PM
I don't know, but I know there is a way in IE to download a different browser
6
 
so does chrome has it?
 
chrome has event listener breakpoints if that's what you mean
 

« first day (1822 days earlier)      last day (3125 days later) »