Click here to Skip to main content
12,824,787 members (38,096 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#3.0 C# ASP.NET
hello friends,

Please See this code, and suggest me where m i wrong....

<%@ WebHandler Language="C#" Class="UploadCS" %>

i use multi file uploader but i cant get list of posted file in files List
when i debug code i found one error when debuger reach this line "files.Add(postedFile);" Exception like
Object reference not set to an instance of an object.

Please help me to solve this issue
Posted 20-Nov-12 21:12pm
Updated 20-Nov-12 21:14pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It seems like the Files entry of your Session isn't initialized. Try to initialize it if it is null. Something like:

List<httppostedfile> files = (List<httppostedfile>)context.Session["Files"];
if (files == null)
    files = new List<httppostedfile>();
    context.Session["Files"] = files;
Shingala Anil 21-Nov-12 2:58am
Hello frnd,
thanks for you replay,
sorry your solution does not work for me...
still i count zero in files list
Shingala Anil 21-Nov-12 3:07am
I solve error but i cant get session value in code behind please help me for that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100