Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.


On March 2, 2005 the ASP.NET 2.0 On Tour came to Belgium, Brussels. This is an international tour, all about the latest Microsoft technology, featuring speakers such as David Platt and Dave Webster.

The subjects of this event were about showing what ASP.NET 2.0 and Visual Studio 2005 had to offer, and how to migrate to these new products and technologies.

One of the sessions was about “Personalization & Membership in ASP.NET 2.0”, by Gunther Beersaerts and Bart De Smet, which was very nice thanks to the good balance between demos and slides.



They talked about the Membership Service, which takes care of the management of users, password generating, validating logins and everything else related to authentication. Other areas of ASP.NET 2.0 they touched were the Role Management Service and the Profile Service.

Trough the Role Management Service, everything related to authorization based on roles can be done in a simple way with static methods to perform key management tasks. While the Profile Service takes care of storing user-specific data persistently in a strongly typed manner, thus making it very easy to customize your site to the logged on user.

This event really gave a good view on what is to come in the web development area.
 
Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
I had a lot off trouble installing DotNetNuke. This popular portal application kept me busy for an entire afternoon and night.

First I got ASP.NET errors about columns missing in tables, then about stored procedures. When those were gone, the application itself managed to hang IE.

So, for everyone else who might be suffering from this, or will give it a try and encounters the same, here's my installation guide for 2.1.2:

The SQL errors occured when using SQL Server as Data Provider, the IE errors always occur.

This step is for everyone using SQL Server:


  • Download DotNetNuke_2.0.4.zip

  • Extract this, follow the normal installation procedure, this version doesn't give any problems.

  • Open the site so that it creates the tables and stored procedures.

  • Download DotNetNuke_2.1.2.zip.

  • Delete all files from 2.0.4 but keep your SQL Server tables.

  • Extract 2.1.2 in the same location.

  • Open the site, now you got passed the missing columns errors!



This step is for everyone:


  • Download DotNetNuke_2.1.1.zip.

  • Extract this to a temporary location and get the file spmenu.js from controls\SolpartMenu.

  • Copy this file to 2.1.2 overwriting it.

  • You now fixed the IE errors!



And at this point you got a working DotNetNuke 2.1.2 version, which you can begin skinning etc.

Let's hope future versions don't require so much hassle.
 
Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
Today I received a question on how to make a usercontrol visible from another usercontrol. You could also see this as: "How could a usercontrol control everything from another usercontrol?"

Normally you wouldn't do this kind of stuff (at least not in my opinion). Usercontrols are to ASP.NET what modules were for VB6, and just like another class, they should function without knowing what's outside their borders, like small functional containers.

Let's take a look at this. First I created a normal page, Default.aspx, and I also made two usercontrols, Control1.ascx and Control2.ascx.

Control2.ascx only has a label, and Default.aspx contains the two usercontrols (named UControl1 and UControl2). Control1.ascx has a button on it, called cmdMakeVis.

First I tried making UControl2 as a public property in Default.aspx, and accessing it from UControl2 through there, unfortunately that gave me an object reference not set error.

My second attempt turned out fine though:

I took the Default.aspx page out of the Context.Handler and searched for UControl2 on it. If I would find it, I could control it. Good thing it worked ;)

Here's the code the button contains:

[csharp]
private void cmdMakeVis_Click(object sender, System.EventArgs e) {
TestSite.DefaultPage Default = (DefaultPage)Context.Handler;
TestSite.Control2 UserControl2 = (Control2)Default.FindControl("UControl2");
if (UserControl2 != null) {
UserControl2.Visible = true;
}
} /* cmdMakeVis_Click *
[/csharp]

I also uploaded this small test project as an illustration.
 
Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
It has been a long time since I posted something, but here I am again. It's a very busy time right now, some exams, loads of school tasks, some websites, etc..

And also, a talk I had to prepare for class. One that I'm going to share with you.

I'll have to disappoint non-Dutch readers though, the slides are written in Dutch, as it was a local session. You could always look at the code though.

The subject was 'Writing Secure ASP.NET'. Covering :

  • Cross-site Scripting

  • SQL Injection

  • Hashing passwords

  • IOPermissions by default

  • Unsafe DSN (DSN with password included)



The first three demo's code should be obvious. Regarding IOPermissions I showed a file browser that could browse trough the system in default ASP.NET installation. And for the Unsafe DSN, I listed system DSNs, or used a demo DSN, showed the tables in it (MySQL only) and executed a query against it.

You can find all files here: SecureASPNET.ppt (227k) and Demo.zip (205k).

 
Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
In response to a thread on the ASP.NET Forums I decided to publish the answers in an overview on my blog.

Someone asked on what the difference were between PHP and ASP.NET and how he did certain things.

My answers are based on using C# as the language for your ASP.NET application.

__________________________________

1. Is there any difference between '' and "" in ASP.NET?

Yes, ' ' is used for characters while " " is for strings.

Take this for example:
'a' = a in memory
"a" = a and \0 in memory

Something useful about escaping in ASP.NET is the following:
@"bla\bla" == "bla\\bla"

A string with an @ in front of it is seen as a literal, where you don't have to escape special characters.

2. How would I do something like: print $variable.'string'; in ASP.NET?

You would use the following: Response.Write(variable + "string");
But it isn't very recommended to use Response.Write, take a look at all the server controls you have, like a Label for example.

3. Within an if language construct, what would be the equivalent of "and" and "or?"

Actually PHP supports the same being used in ASP.NET:

and --> &&
or --> ||

Example:
[csharp]
if (((number == 5) && (number2 != 8)) || (admin == true)) {

// do stuff

}
[/csharp]

Would correspond to:
if (number = 5 AND number2 NOT equal to 8 ) OR we're an admin., do stuff.

4. Would someone be able to tell me how I could make an ASP.NET equivalent of this PHP Function:

[php]
function num($number){
return '#' . str_pad($number, 3, '0', STR_PAD_LEFT);
}
[/php]

You need a function which returns a string, and which formats a string:

[csharp]
public string num(int number) {
return String.Format("#{0}", number.ToString("000"));
}
[/csharp]

5. How do I create a mutidimensional array?

Try this:

[csharp]
// 2 dimensional arrays
int [,] a1;
a1 = new int[3,2];
int [,] a2 = {{1,2}, {3,4}, {5,6}};

// jagged arrays
int[][] a3;
a3 = new int[3][];
a3[0] = new int[5]{1, 2, 3, 4 ,5};
a3[1] = new int[3];
a3[2] = new int[4]{21, 22, 23, 24};
[/csharp]

Loop over them to see the elements.

__________________________________

Got a question yourself? Ask it, and I'll try to help :)