views:

173

answers:

0

On my website everything works fine in the Application_AcquireRequestState event from Global.asax file.

Now, I am trying to create a desktop application wich take MotherBoard, Processor and HDD serials numbers and combine them to create a Unique ID for each user that use my website. They are not allowed to login from multiple accounts using the same computer.

They must login to my website only from this desktop application. After the Unique ID is calculated by my desktop app, I am sending this ID to my databse by calling an URL www.example.com/Verify.ashx?user=aaa&password=bbb&machineId=ccc with an WebClient instance.

The problem is in my Application_AcquireRequestState event. This event make use of HttpContext.Current.Session object. This works just fine by accessing the site through any normal browser.

Requesting Verify.ashx page through WebClient class from my desktop application trows an exception wich says that HttpContext.Current.Session is null.

Any workaround ?

EDIT: Resolved by using an normal Verify.ASPX page with

protected void Page_Load(object sender, EventArgs e)
{
    Response.Clear();
    // code
    Response.End();
}

Won't this still process all controls from the masterpage ?