Archive for category Security

WebsiteSpark Unsubscribe – is it possible?

I would say it is not. Why? Well, because they send you a broken unsubscribe links.
Of course i did that long time ago in the account options (currently cancelled) but it kept sending me various emails.
Most of them if not all, do not contain an unsubscribe link. And now they finally added the link at the footer but it does not work.
If you click it does nothing as it starts with “file:///C%7C/Users/Stephen/Desktop/Projects” etc.
This is the whole link:
Read the rest of this entry »

ASP.NET versus ASP Classic

ASP.NET is SuperiorIf you often revise your decision to go for .NET. then let me tell you a few things about ASP.NET.

By the way, if I have to be an ASP developer starting now I would rather work as a cleaner in a public WC indeed.

Here we go:  Read the rest of this entry »

How to Remove unused Application Pools using ServerManager Class

Public Sub RemoveUnusedApplicationPools()
        Dim manager As New ServerManager
        Dim AppPools As New List(Of String)
        ' fill the list with all pools
        For Each apppool As ApplicationPool In manager.ApplicationPools
            AppPools.Add(apppool.Name)
        Next
 
        ' if it's used remove from the total list
        For Each website As Site In manager.Sites
            For Each app As Application In website.Applications
                AppPools.Remove(app.ApplicationPoolName)
            Next
        Next
 
        ' remove the unused pools
        For Each unusedApplicationPool As String In AppPools
            Dim apppool As ApplicationPool = manager.ApplicationPools(unusedApplicationPool)
            manager.ApplicationPools.Remove(apppool)
        Next
 
        ' call the commitchanges method
        manager.CommitChanges()
        manager.Dispose()
    End Sub

A regex that matches all credit cards

Regular Expression For Credit Card Numbers

Regular Expression For Credit Cards

This is a regular expression that validates all credit card numbers including VISA, MASTER, AMEX and DISCOVERY! ^((4\d{3})|(5[1-5]\d{2})|(6011)|(34\d{1})|(37\d{1}))-?\d{4}-?\d{4}-?\d{4}|3[4,7][\d\s-]{15}$

<asp:RegularExpressionValidator ID="CreditCardValidator" runat="server" 
   ControlToValidate="CreditCardNumber" Display="Static" 
   ErrorMessage="Please enter valid card number" 
   ValidationExpression="^((4\d{3})|(5[1-5]\d{2})|(6011)|(34\d{1})|(37\d{1}))-?\d{4}-?\d{4}-?\d{4}|3[4,7][\d\s-]{15}$"  
  ValidationGroup="CustomSignup" Text="*" />

Programmers and the Recession

Programmers And The RecessionHaving a permanent job is priceless these days (you know, recession and stuff). But, it’s sort of limitation for your creativity. Working for you is much better. You often work on projects of your choice, set your own hours, and enjoy the flexibility to take a break whenever you want.

However to afford that, you must be very good if not the best at what are you doing. e.g. .NET programming, Website Design etc. I had luck with all of the above so now i am doing pretty good having a standard income on monthly basis plus I work on other projects as a freelancer.
Read the rest of this entry »

ASP.NET Exception – Invalid postback or callback argument

Invalid postback or callback argument

Invalid postback or callback argument

I’ve read many different suggestions for the Invalid postback or callback argument exception but, most of them do not work.
Some people will suggest to add your code inside If Not Page.IsPostBack Then block, other will tell you to set EnableEventValidation to false which is not serious at all. Even the compiler suggests ClientScriptManager.RegisterForEventValidation method but in most of the situations these will not work.

One is for certain: This specific exception is mostly thrown when you use a Master page!!!

Add the same javascript attributes to the very same server control out of the master page and you’ll see that it is working just fine.
Read the rest of this entry »

Force ASP.NET Page to Use secure HTTP (https) with SSL/TLS

Force ASP.NET to use HTTPS

Force ASP.NET to use HTTPS

Sometimes we want to provide encryption and secure identification of the server creating a secure channel over an insecure network.
In that case we need HTTPS connection which ensures reasonable protection e.g. for payment transactions.

 

Ok let’s see how this thing works.

Say that your page is as follows: http://www.domain.com/yourpage.aspx
Ok, just add this code inside Load Event Handler and voila! That’s it!

 

If Not Request.IsSecureConnection Then
   Response.Redirect("https://www.domain.com/yourpage.aspx ")
End If