Log in

Tag Archives: C#

18
November

vCalendar – C# Implementation

Written by Adnan Rashid. No comments Posted in: Development, General
Tagged with ,

I needed to integrate support for vCalendar in my current project. So i went through the vCalendar spec 1.0 at http://www.imc.org/pdi/vcal-10.txt and wrote this class. Although I have not implemented all the specification features, but this should prove sufficient for the usual requirements. If you have any comments / suggestions , let me know.

using System;
using [...]

10
October

If you are using LINQ and have a query that looks something like this :

var myUser = (from user in dbContext.Users
join comp in dbContext.Companies on user.CompanyID equals comp.CompanyID
where user.UserID == “12345″
select new {user.UserID, user.Name, comp.Name}).SingleOrDefault();

string _userID = myUser.UserID;
string _userName = myUser.Name;
string _companyName = myUser.Name;

In the above code, example we are using a syntactic sugar feature [...]

28
September

Asp.net Read Reciept Request

Written by Adnan Rashid. No comments Posted in: Development
Tagged with , ,

Heres a quick tip. If you need to include a request for read receipt like Microsoft Outlook while sending mails through Asp.net, just add the Disposition-Notification-To Header to the MailMessage.
The MailMessage class does not have a corresponding attribute and thus it has to be set through the Header.

MailMessage mm = new MailMessage(fromAddress, toAddress);
mm.Subject = subject;
mm.Headers.Add("Disposition-Notification-To", [...]

26
September

Generic Handler – Session State

Written by Adnan Rashid. No comments Posted in: Development
Tagged with , ,

In my current project I needed to access the Session state in a Generic Handler. To my dismay, i realized that the Session StateBag was null. The StateBag class is sealed and manages the Viewstate of the Asp.net server controls and pages.
Upon discussion with my colleague, Mr. Hamed, we found the solution to my problem. [...]

08
July

Encypting query string in asp.net

Written by Adnan Rashid. No comments Posted in: Development
Tagged with , ,

When you pass information from one page to another, you are passing information that anybody can sniff. For example consider a scenario, in which you pass the customer id as a query string:
http://www.yourapplication.com?customer_id=15
Now if somebody replaced 15 with say 10 or any other number, they can pull up other customer information. And thats a bad [...]

06
July

ASP.net Reset Password

Written by Adnan Rashid. 1 comment Posted in: Development
Tagged with , ,

If you are using Membership Provider in your ASP.net application, you might come across a scenario in which you need to have both Security Question and Answer feature and would also like to programmatically reset the password for an account.
So if you run the code

string username = “user”;
string password = “password”;
MembershipUser mu = Membership.GetUser(username);
mu.ChangePassword(mu.ResetPassword(), password);

You [...]