A long time ago (at least it feels a long time ago), I mentioned that I’d be learning some more ASP.Net soon. It seems that day is today.
I’m building a platform at work for communicating software information, getting information back about non-usage, duplications and prohibited software.
The idea really is to make it as flexible as possible, and as low effort on the user as possible. This means a few things:
- Single sign on (that is, the application gets your user id, and then looks up data relevant to you). Really I don’t know why every business Intranet site isn’t single sign on.
- Sparse interface. It’s a very simple idea, so I want to keep the interface as straight forward as possible. The buttons will be big and clear and there won’t be many of them (usually just yes and no).
- Single summary push emails. If there are 10 updates, that shouldn’t mean 10 separate emails, it should mean one eMail with them all in. Maybe sent weekly or monthly. I like the Facebook way of handling this (well, I don’t – I don’t care about my pending notifications, but I like the idea).
The first thing I needed to learn, then, was how to get the logged in user ID so I could do something with it.
It turns out asp.net is actually quite different from PHP and Classic ASP (and basically every other coding language I’ve used). It’s an abstraction layer, and all sorts of things happen between you writing the code and it being posted. However, the thing I picked up today was how to get the username.
Dim Username = User.Identity.Name
Message.Text = MID(User.Identity.Name,INSTR(User.Identity.Name,””)+1)
This bit is quite standard, and what I use to trim off the domain to return just the userid:
But the rest is actually quite weird. However, now that I’ve started using this, I think I might like it a lot – it seems very easy to build pages. Easier than php or classic ASP, which is strange as I thought you were meant to be paid for coding in .Net. Strange, eh?