Show Brackets in Asp.net - c#

when users login to their account then i show their names and also their designations it works but when i show designation it shows like mix means that username+designation for example JOHNMANAGER .here manager is desgination and same like this happend in my side but i want designations type in brackets.
here is code
string desginname = Convert.ToString(loginusers.spdesignname(txt_username.Value, txt_pass.Value));
Session["UserDesignationName"] = desginname;
if (users == 1)
{
Session["Login2"] = txt_username.Value;
Session["Login3"] = txt_pass.Value;
Session["UserDesignationID"] = desginid;
//Session["DepartmentID"] = depid; ;
Session["UserDesignationName"] = desginname;
Session["UserTypeID"] = users;
Response.Redirect("alldocuments.aspx");
}
else if (users == 2)
{
Session["Login2"] = txt_username.Value;
Session["Login3"] = txt_pass.Value;
Session["UserDesignationID"] = desginid;
Session["UserDesignationName"] = desginname;
Session["UserTypeID"] = users;
Response.Redirect("alldocuments.aspx");
}
}
catch
{
errrros.Text = "Incorrect User Name or Password";
}
and here is in site master ...
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Session["Login2"] != null & Session["UserDesignationName"]!=null)
{
["UserDesignationID"].ToString();
WELCOME.Text = Session["Login2"].ToString() +Session
[("UserDesignationName")].ToString();
}
lbtnLogout.Visible = Session["Login2"] != null || Session["Login2"] !=
null;
}
}
and here is the image
image

Add them in where you build the welcome text:
WELCOME.Text = Session["Login2"].ToString() + " (" + Session
[("UserDesignationName")].ToString() + ")";
or better, use String.Format:
WELCOME.Text = String.Format("{0} ({1})",
Session["Login2"].ToString(),
Session[("UserDesignationName")].ToString());

Try This.
WELCOME.Text = Session["Login2"].ToString() +
" (" + Session["UserDesignationName"].ToString() +")";

Just use following line of code if designation name is not supplied.
WELCOME.Text = Session["Login2"].ToString() + (Session["UserDesignationName"].ToString()!="" ? " (" + Session["UserDesignationName"].ToString() + ")" : string.Empty) ;

Related

Filename overwrites the uploaded attachments

The file name is generated by Po+Invoice in the sql table. When user attach a pdf it overwrites the existing file name that has same po+invoice. Is there anyway i could create the unique id filename.
public partial class upload : System.Web.UI.Page
{
string mID;
DataBaseDataContext dataBaseDataContext = new DataBaseDataContext();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnExit_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
protected void SUbmit(object sender, EventArgs e)
{
try
{
var ext = FileUploadtoServer.FileName.Substring(FileUploadtoServer.FileName.IndexOf('.') + 1, 3);
if (ext.ToLower() != "pdf")
{
Response.Write("<script>alert('Please select a pdf File!')</script>");
return;
}
}
catch (Exception ex)
{
Response.Write("<script>alert('Please select a pdf File!')</script>");
return;
}
if (PO_Number.Text.Equals("") || HeadCode.Text.Equals("") || Manufacture.Text.Equals("") || Description.Text.Equals("") || Invoice.Text.Equals(""))
{
Response.Write("<script>alert('Please Fill All Fields!')</script>");
}
TPT tPT = new TPT();
tPT.Invoice_No = Invoice.Text;
tPT.PO_Number = PO_Number.Text;
tPT.Item_Code = Manufacture.Text;
tPT.Heat_Code = HeadCode.Text;
tPT.Description = Description.Text;
tPT.FileName = PO_Number.Text + Invoice.Text + ".pdf";
dataBaseDataContext.TPTs.InsertOnSubmit(TPT);
dataBaseDataContext.SubmitChanges();
String path = Server.MapPath("Attachments/" + PO_Number.Text + Invoice.Text + ".pdf");
FileUploadtoServer.SaveAs(path);
Response.Write("<script>alert('Successfully Inserted!')</script>");
Invoice.Text = "";
Manufacture.Text = "";
HeadCode.Text = "";
Description.Text = "";
PO_Number.Text = "";
}
}
I have tried
Guid.NewGuid() + ".pdf";,
it still does the same thing.
The simple way would be to just take the file name, and add -1, then -2, then -3
So,
mydoc.pdf
mydoc-1.pdf
mydoc-2.pdf
etc. etc.
So, then say a function like this:
Edit: Updated code
string GetServerFilenext(string strFileFullPath)
{
string strFileToCheck = "";
for (int i = 0; i < 100; i++)
{
if (i == 0)
strFileToCheck = strFileFullPath;
else
strFileToCheck =
Path.GetDirectoryName(strFileFullPath) +
#"\" + Path.GetFileNameWithoutExtension(strFileFullPath) +
"-" + i.ToString() + Path.GetExtension(strFileFullPath);
if (!File.Exists(strFileToCheck))
break;
}
return strFileToCheck;
}
So, now your code becomes this:
string sFileToSave =
Server.MapPath(#"~/Attachments/" + PO_Number.Text + Invoice.Text + ".pdf");
sFileToSave = GetServerFileNext(sFileToSave);
tPT.FileName = Path.GetFileName(sFiletoSave);
So, you setup the full path and file name.
You then check if it exists, and if not, then add -1, then -2 etc. etc.
Edit2: So, code would look like this (warning: air code)
string sFileToSave =
Server.MapPath(#"~/Attachments/" + PO_Number.Text + Invoice.Text + ".pdf");
sFileToSave = GetServerFileNext(sFileToSave);
TPT tPT = new TPT();
tPT.Invoice_No = Invoice.Text;
tPT.PO_Number = PO_Number.Text;
tPT.Item_Code = Manufacture.Text;
tPT.Heat_Code = HeadCode.Text;
tPT.Description = Description.Text;
tPT.FileName = Path.GetFileName(sFileToSave);
dataBaseDataContext.TPTs.InsertOnSubmit(TPT);
dataBaseDataContext.SubmitChanges();
FileUploadtoServer.SaveAs(sFileToSave);
Instead of adding -1,-2, i was able to upload it by adding date stamp
`tPT.FileName = PO_Number.Text + Invoice.Text + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";`

While binding combobox how could I get binded data in uppercase format in c#.net

I want to bind the combobox in c#.net windows application and that also the binded combobox I want in uppercase word.
Now, I bind the combobox successfully but the problem is that I didnt get any uppercase word in it.
Here is my code,
public void BindDropdownList(ComboBox f_dropdown, string tblname, string display_field, string value_fldName, string wherecondition = "")
{
try
{
string qrysel = "select " + value_fldName + "," + display_field + " from " + tblname + " " + wherecondition + "";
DataTable dt_list_detail = new DataTable();
dt_list_detail = clsObjDataAccess.GetDataTable(qrysel);
if (dt_list_detail != null)
{
if (dt_list_detail.Rows.Count > 0)
{
f_dropdown.DataSource = dt_list_detail;
f_dropdown.DisplayMember = display_field;
f_dropdown.ValueMember = value_fldName;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
I tried many things but didnt work like
f_dropdown.DataSource = dt_list_detail;
f_dropdown.DisplayMember = display_field.ToUpper();
f_dropdown.ValueMember = value_fldName.ToUpper();
next
f_dropdown.DisplayMember = display_field.ToString().ToUpperInvariant();
and many other thing also but the same thing happing with me that is not working in upper case word.
You could do the following.
f_dropdown.Format += (s, arg) =>
{
arg.Value = arg.Value.ToString().ToUpperInvariant();
};
Test Collection
_persons = new List<Person>
{
new Person(){Id=1, Name = "Anu"},
new Person(){Id=1, Name = "Jia"},
};
f_dropdown.DataSource =
f_dropdown.DisplayMember = "Name";
f_dropdown.Format += (s, arg) =>
{
arg.Value = arg.Value.ToString().ToUpperInvariant();
};
Output

Doesn't parse updated row from LinqToSQLDataClass to Database LINQ C# WPF

I'm building an Edit/Update system in my program using Linq in C# WPF.
My problem is that my code does submit to the LinqToSQLDatacontex but doesn't parse it through to the actual Database.
The result of that is that the datarow is updated in Runtime but in fact isn't updated in the actual Database.
this is the code I use for Updating my rows.
private void dgUsers_MouseUp(object sender, MouseButtonEventArgs e)
{
try
{
item = dgUsers.SelectedItem;
this.name = (dgUsers.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;
var query =
from t in db.tbl_Users
where t.Name == name
select t;
foreach (var q in query)
{
tbMoreName.Text = q.Name;
tbMoreRights.Text = q.Rights;
tbMoreTag.Text = q.Operatortag;
checkMoreActive.IsChecked = q.Active;
tbMoreCardCode.Text = q.CardCode;
}
var table =
from q in db.tbl_UserProfiles
where q.Userprofile == tbMoreRights.Text
select q;
}
catch (Exception exc)
{
MessageBox.Show("NOPE");
}
}
private void btnSaveUser_Click(object sender, RoutedEventArgs e)
{
switch (saveType)
{
case "Edit":
#region save Edit User
var edit =
(from t in db.tbl_Users
where t.Name == name
select t).First();
MessageBox.Show(edit.Id.ToString() + " " + edit.Name.ToString() + " " + edit.Operatortag.ToString() + " " + edit.Rights.ToString() + " " + edit.Active.ToString());
edit.Id = edit.Id;
edit.Name = tbName.Text;
edit.Operatortag = tbOperatortag.Text;
edit.Rights = cbRights.Text;
edit.Active = checkActive.IsChecked.Value;
edit.CardCode = tbCardcode.Text;
MessageBox.Show(edit.Id.ToString() + " " + edit.Name.ToString() + " " + edit.Operatortag.ToString() + " " + edit.Rights.ToString() + " " + edit.Active.ToString() + " " + edit.CardCode.ToString());
db.SubmitChanges();
#endregion
saveType = "";
break;
}
var refresh =
(from q in db.tbl_Users
select new { Name = q.Name, Rights = q.Rights, Operatortag = q.Operatortag, Active = q.Active, Cardcode = q.CardCode }).ToList();
dgUsers.ItemsSource = null;
dgUsers.ItemsSource = refresh;
MessageBox.Show(refresh[0].ToString() + " " + refresh[1].ToString() + " " + refresh[2].ToString() + " " + refresh[3].ToString() + " " + refresh[4].ToString());
}
I hope that one of you guys can help me.
Thanks in advance!!!

even when details view insert fails the application is sending an email

I have an details view that is attached to a sql datasource. When a new workorder is inserted i am sending an email. Right now there is some issue with my program and the user is not able to insert the data from my application but the email still gets send assuming the data is inserted.
This is my Details View Inserted Method:
protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
if (successfull == true && Page.IsValid && e.AffectedRows ==1)
{
//TextBox TextBoxWorkOrderNumber = (TextBox)(DetailsView1.FindControl("TextBox11"));
TextBox TextBoxRequestor = (TextBox)(DetailsView1.FindControl("TextBox3"));
TextBox TextBoxDate = (TextBox)(DetailsView1.FindControl("TextBox1"));
//TextBoxDate.Text = DateTime.Now.ToShortDateString();
TextBox TextBoxDepartment = (TextBox)(DetailsView1.FindControl("TextBox4"));
TextBox TextBoxCompletionDate = (TextBox)(DetailsView1.FindControl("TextBox16"));
TextBox TextBoxMachineDescription = (TextBox)(DetailsView1.FindControl("TextBox5"));
TextBox TextBoxMachineLocation = (TextBox)(DetailsView1.FindControl("TextBox6"));
TextBox TextBoxWorkRequired = (TextBox)(DetailsView1.FindControl("TextBox7"));
// DropDownList status = (DropDownList)(DetailsView1.FindControl("DropDownList2"));
TextBox TextBoxStatus = (TextBox)(DetailsView1.FindControl("TextBox12"));
TextBoxStatus.Text = "Open";
DropDownList list = (DropDownList)(DetailsView1.FindControl("DropDownList1"));
TextBox9.Text = list.SelectedValue;
DropDownList lists = (DropDownList)(DetailsView1.FindControl("DropDownList2"));
TextBox14.Text = lists.SelectedValue;
if (TextBoxRequestor.Text.Length <= 0)
{
TextBoxRequestor.Text = "Not Applicable";
}
if (TextBox14.Text.Length <= 0)
{
TextBoxDepartment.Text = "Not Provided";
}
if (TextBoxCompletionDate.Text.Length <= 0)
{
TextBoxCompletionDate.Text = "Not Provided";
}
if (TextBoxMachineDescription.Text.Length <= 0)
{
TextBoxMachineDescription.Text = "Not Provided";
}
if (TextBoxMachineLocation.Text.Length <= 0)
{
TextBoxMachineLocation.Text = "Not Provided";
}
if (TextBoxWorkRequired.Text.Length <= 0)
{
TextBoxWorkRequired.Text = "Not Provided";
}
if (TextBox9.Text == "Safety" && e.AffectedRows==1)
{
{
bool isLocal = HttpContext.Current.Request.IsLocal;
if (isLocal == true)
{
string id = TextBox13.Text.ToString();
System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();
mm.From = new System.Net.Mail.MailAddress("no_reply_workorder#.com");//who send
mm.To.Add(new System.Net.Mail.MailAddress("abc#.com"));
//abc#abc.com
mm.Subject = "WorkOrders Type Safety";
mm.Body = "DO NOT REPLY TO THIS EMAIL" + "<br><br/>" + "WorkOrderNumber"
+ ": " + "<a href=\"http://localhost:49695/SafetyReport.aspx?WorkOrderNum=" + TextBox13.Text + "\">"
+ TextBox13.Text + "</a>" + "<-Click on the Work Order Number For Report"
+ "<br><br/>" + "WorkOrderNumber" + ": " +
"<a href=\"http://localhost:49695/Safety.aspx?WorkOrderNum=" +
TextBox13.Text + "\">" + TextBox13.Text + "</a>" +
"<-Click on this Work Order Number To Enter Data" +
"<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text +
"<br><br/>" + "Date" + ": " + TextBoxDate.Text +
"<br><br/>" + "Department" + ": " + TextBox14.Text +
"<br><br/>" + "Machine Description" + ": " +
TextBoxMachineDescription.Text + "<br><br/>" +
"Machine Location" + ": " +
TextBoxMachineLocation.Text + "<br><br/>" +
"Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>"
mm.IsBodyHtml = true;
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
client.Host = ConfigurationManager.AppSettings["smtpServer"];
client.Send(mm);
captureuseremail();
}
}
}
}
i see an DetailsView1_Item Inserting how can i check if that is inserting into the sql database?? if the inserting is successful i like to set a boolean value to true and if true then perform the Details_View1 Inserted and send email else cancel the insert.
i am also using the insert button that comes with the details view. please ask me for additional code if your confused and i would more than happily provide it.
please help :(
Added Additional code:
INSERT INTO Master(Requestor, Date, Department, CompletionDate, MachineDescription,
MachineLocation, [Type of Work Order], [Work Required], Status)
VALUES (#Requestor, #Date, #Department, #CompletionDate,
#MachineDescription, #MachineLocation, #Type_of_Work_Order,
#Work_Required, #Status); SET #NewId = Scope_Identity()
i just have a bool successfull; which i set to true at the end of Item_Inserting method().
when user clicks submit on the details view which is nothing but the command button insert then the code hits the item_inserting takes all the value
Item_Inserting of the details view:
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
if (Page.IsValid)
{
//TextBox TextBoxWorkOrderNumber = (TextBox)(DetailsView1.FindControl("TextBox11"));
TextBox TextBoxRequestor = (TextBox)(DetailsView1.FindControl("TextBox3"));
TextBox TextBoxDate = (TextBox)(DetailsView1.FindControl("TextBox1"));
//TextBoxDate.Text = DateTime.Now.ToShortDateString();
TextBox TextBoxDepartment = (TextBox)(DetailsView1.FindControl("TextBox4"));
TextBox TextBoxCompletionDate = (TextBox)(DetailsView1.FindControl("TextBox16"));
TextBox TextBoxMachineDescription = (TextBox)(DetailsView1.FindControl("TextBox5"));
TextBox TextBoxMachineLocation = (TextBox)(DetailsView1.FindControl("TextBox6"));
TextBox TextBoxWorkRequired = (TextBox)(DetailsView1.FindControl("TextBox7"));
// DropDownList status = (DropDownList)(DetailsView1.FindControl("DropDownList2"));
TextBox TextBoxStatus = (TextBox)(DetailsView1.FindControl("TextBox12"));
TextBoxStatus.Text = "Open";
DropDownList list = (DropDownList)(DetailsView1.FindControl("DropDownList1"));
TextBox9.Text = list.SelectedValue;
DropDownList lists = (DropDownList)(DetailsView1.FindControl("DropDownList2"));
TextBox14.Text = lists.SelectedValue;
if (TextBoxRequestor.Text.Length <= 0)
{
TextBoxRequestor.Text = "Not Applicable";
}
if (TextBox14.Text.Length <= 0)
{
TextBoxDepartment.Text = "Not Provided";
}
if (TextBoxCompletionDate.Text.Length <= 0)
{
TextBoxCompletionDate.Text = "Not Provided";
}
if (TextBoxMachineDescription.Text.Length <= 0)
{
TextBoxMachineDescription.Text = "Not Provided";
}
if (TextBoxMachineLocation.Text.Length <= 0)
{
TextBoxMachineLocation.Text = "Not Provided";
}
if (TextBoxWorkRequired.Text.Length <= 0)
{
TextBoxWorkRequired.Text = "Not Provided";
}
successfull = true;
}
else
{
e.Cancel = true;
successfull = false;
}
}
This is Where the actual insert takes place, its my sqldatasource:
**all the values from the item_inserting are inserted here with an identity value **
protected void RequestorSource_Inserted(object sender, SqlDataSourceStatusEventArgs e)
{
if (successfull == true)
{
try
{
int newid = (int)e.Command.Parameters["#NewId"].Value;
TextBox13.Text = newid.ToString();
}
catch
{
successfull = false;
}
if (e.AffectedRows == 1 && successfull == true)
{
successfull = true;
}
else
{
successfull = false;
}
}
else
{
successfull = false;
}
}
the issue is the email is still getting sent when i stop the program, how can i create a bad insert like i want it to fail similar what is happening to the user i am not able to recreate the issue for example i tried adding a new field in the insert statement but did not give it any values and the error it threw was you have more columns then values.
This is a picture of my details view:
**all of the .cs code at http://pastebin.com/6VC6FZK7 and the .aspx code at http://pastebin.com/QhjWNNt0 ** hope this helps out a bit.
If you just setting the bool successful to true after the insert and have not done any error checking then it can fail and still send the email. I suggest either wrapping the insert code in a TRY..CATCH..and set the succssful state to false in the catch OR running a IF...ELSE.. to check if the data was inserted correctly and setting the successful state there.

response redirect makes session_end in global asax

I am getting frustrated due to the session become null.When I click on save button I save the data to DB from code behind and if this successfully I am redirecting the user to the main projects page,using syntax:
Response.Redirect("~/Admin/Projects.aspx?i=esc&prjName=abc",'false');
but its make my session null.Its goes to Globex.asax page ang executes the Session_End and make all session null.
I even tried Server.Transfer but by this the browser url remains same and client doesn't want this.Even some where I read that the Server.Execute is also used to redirect but it is showing some wrong results.
can I use the Response.Redirect without this session null problem ??
(In this page I am creating the text file to store some long description and if this is successful then I am redirecting to the another page.)
Update::
here is my code for button click
protected void lnkbtnAddDescription_Click(object sender, EventArgs e)
{
try
{
if ((!hidProjId.Value.ToString().Equals("") || !hidEditProjId.Value.ToString().Equals("")) && !txtDescription.Value.ToString().Equals(""))
{
//ProjectDescription
int projId = 0;
if (!hidIsEdit.Value.ToString().Equals(""))
{
projId = Convert.ToInt32(hidEditProjId.Value.ToString());
}
else
{
projId = Convert.ToInt32(hidProjId.Value.ToString());
}
ProjectM proj = new ProjectM();
proj.LoadByKey(projId);
string prj = proj.ProjectName.ToString().Replace(" ", "-");
string strDirectoryPath = Server.MapPath("~/ProjectDescription/") + proj.ProjectId + "-" + prj;
if (!Directory.Exists(strDirectoryPath))
{
Directory.CreateDirectory(strDirectoryPath);
string filePath = strDirectoryPath + "/" + proj.ProjectId + "-" + prj + ".txt";
string strDescription = txtDescription.Value.ToString().Replace("<br />", "<p>");
createTextFile(filePath, strDescription);
string dbDirectoryPath = "~/ProjectDescription/" + proj.ProjectId + "-" + prj + "/" + proj.ProjectId + "-" + prj + ".txt";
proj.Description = dbDirectoryPath.ToString();
proj.IsNew = false;
proj.Save();
if (!hidIsEdit.Value.ToString().Equals(""))
{
//Server.Execute("~/SuperAdmin/Projects.aspx?i=esc&prjName=" + proj.ProjectName.ToString() + "",false);
Session["dsProj"] = null;
Session["editProjId"] = null;
Session["fname"] = hidFname.Value.ToString();
Session["UserId"] = hidUserId.Value.ToString();
Session["role"] = hidRole.Value.ToString();
Response.Redirect("~/SuperAdmin/Projects.aspx?i=esc&prjName=" + proj.ProjectName.ToString());
}
else
{
//Server.Execute("~/SuperAdmin/Projects.aspx?i=sc&prjName=" + proj.ProjectName.ToString() + "",false);
Session["dsProj"] = null;
Session["editProjId"] = null;
Session["fname"] = hidFname.Value.ToString();
Session["UserId"] = hidUserId.Value.ToString();
Session["role"] = hidRole.Value.ToString();
Response.Redirect("~/SuperAdmin/Projects.aspx?i=sc&prjName=" + proj.ProjectName.ToString());
}
}
else
{
Directory.Delete(strDirectoryPath, true);
Directory.CreateDirectory(strDirectoryPath);
string fileName = proj.ProjectName.ToString().Replace(" ", "-");
string filePath = strDirectoryPath + "/" + proj.ProjectId + "-" + fileName + ".txt";
string strDescription = txtDescription.Value.ToString().Replace("<br>", "<p>");
createTextFile(filePath, strDescription);
string dbDirectoryPath = "~/ProjectDescription/" + proj.ProjectId + "-" + proj.ProjectName.ToString() + "/" + proj.ProjectId + "-" + proj.ProjectName.ToString() + ".txt";
proj.Description = dbDirectoryPath.ToString();
proj.IsNew = false;
proj.Save();
if (!hidIsEdit.Value.ToString().Equals(""))
{
//Server.Execute("~/SuperAdmin/Projects.aspx?i=esc&prjName=" + proj.ProjectName.ToString() + "", false);
Session["dsProj"] = null;
Session["editProjId"] = null;
Session["fname"] = hidFname.Value.ToString();
Session["UserId"] = hidUserId.Value.ToString();
Session["role"] = hidRole.Value.ToString();
Response.Redirect("~/SuperAdmin/Projects.aspx?i=esc&prjName=" + proj.ProjectName.ToString());
}
else
{
//Server.Execute("~/SuperAdmin/Projects.aspx?i=sc&prjName=" + proj.ProjectName.ToString() + "", false);
Session["dsProj"] = null;
Session["editProjId"] = null;
Session["fname"] = hidFname.Value.ToString();
Session["UserId"] = hidUserId.Value.ToString();
Session["role"] = hidRole.Value.ToString();
Response.Redirect("~/SuperAdmin/Projects.aspx?i=sc&prjName=" + proj.ProjectName.ToString());
}
}
}
}
catch (Exception)
{
}
}
private void createTextFile(string filePath, string strDescription)
{
try
{
StreamWriter w = File.CreateText(filePath);
w.WriteLine(strDescription);
w.Flush();
w.Close();
}
catch (Exception ex)
{
}
}
Before you redirect to the next page,
assign the existing session value in the button click event also.
This would solve the problem.
hope this will be helpful to you,
ASP.NET Session becomes null after postback on local
This think your problem is related to some kind of permission denial, which is nulling your session.
There must be a problem in creating or saving the text file.
This may be making Session_End call so you are getting all values null.
Folder delete, move, rename causes Session end and long refresh
http://www.telerik.com/community/forums/aspnet-ajax/file-explorer/folder-delete-move-rename-causes-session-end-and-long-refresh.aspx#1365780

Categories