They say you learn something new every day.

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:

  1. 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.
  2. 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).
  3. 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.

Sub Page_Load()
Dim Username = User.Identity.Name
Message.Text = MID(User.Identity.Name,INSTR(User.Identity.Name,””)+1)
End Sub

This bit is quite standard, and what I use to trim off the domain to return just the userid:

MID(User.Identity.Name,INSTR(User.Identity.Name,””)+1)

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?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: