Showing posts with label variables. Show all posts
Showing posts with label variables. Show all posts

Saturday, March 31, 2012

session timeout.... again

Hi Everyone -

This session timeout thing has popped up again.

Is there a way to globally redirect the user to a timeout
page when the session variables have timed out?

I really don't want to add a check on each and every page
in the page_load that will check the session.

please advise...

I've tried to check the session variable in the global.asax
file in the

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
if session.Item("company_id") is nothing then
response.Redirect("logout.aspx")
End If
End Sub

but the session object is not allowed in this context

any ideas would be appreciated

thanks
tonyAn alternate method will be create a small function in one of the module and then just call the function at the top of each page.

Function Is_Session_Alive will return Flase is session has lost its values otherwise True

At the start of each page
If Is_Session_Alive(Session("Language"), Session("Service"), Session("Department")) = False Then
Response.Redirect("DefaultErrorPage.aspx")
End If

Thanks
Shafiq
make a class inheriting the page and code there.

subsiquently inherit new class on every page

hemant

Thursday, March 29, 2012

Session Variable across applications

If I have multiple applications inside a website, will session variables
persist if I like between the two applications?That's 'link' between two applications.
DogBoy,

I'd say yes

Cheers Al
As long as they're under the same website in IIS.
This doesn't seem to be working, the session variable is coming up null when I try to
jump applications in the same website. Any ideas?
Damn, looks like I was wrong. You can not share session variables across apps. You will need to pass them across using encrypted querystrings, post requests, and the like.
I'm not sure I fully understand what you're trying to do. This is what I think you're doing, let me know if this is not right -

your main site has a url like this

www.mysite.com

Note: This assumes you don't have extra domain names set up, trying to keep it simple!

To access app 1 you'd enter www.mysite.com/app1
To access app 1 you'd enter www.mysite.com/app2

If this is what you're doing then I know that cookies and session variables can definitely be shared because I'm doing it with a project I'm currently working on.

Cheers Al
That's what I'm trying to do - but the session variables are not jumping apps. The apps are configured in IIS, are yours configured that way or just sub directories?

I was thinking of using cookies, I know they are persistent but apparantly not session variables.
Mine are sub folder under the main site.

So I guess that's the end of that
I was thinking of what aconybeare mentioned here too, but then I realized you're talking about virtual directories, which are basically separate ASP.NET applications.

Session variable are shared between users

Hi,
I keep several variables in a statevalue like:
Dim session As SessionState.HttpSessionState =
System.Web.HttpContext.Current.Session

session("connect") = " FKHFSF "

I thought that these variables would be the exclusive use of one connected
user/connection. But it looks like that in a multiuser enviroment some
variables are shared. So I end on the page somenone else was editing.

What am I missing here. (I have not modified any property of the session
variable)

TonNo other code than that ? It looks like it should work (of course all users
will have the same connect value if you store always FKHFSF for all users).
What if you are using directly System.Web.HttpContext.Current.Session.

Other than that , it would like as if you were using a shared property
somewhere...

Patrice

"ton" <vrs@.REMOVEhome.nl> a crit dans le message de
news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> Hi,
> I keep several variables in a statevalue like:
> Dim session As SessionState.HttpSessionState =
> System.Web.HttpContext.Current.Session
> session("connect") = " FKHFSF "
> I thought that these variables would be the exclusive use of one connected
> user/connection. But it looks like that in a multiuser enviroment some
> variables are shared. So I end on the page somenone else was editing.
> What am I missing here. (I have not modified any property of the session
> variable)
> Ton
No other code than that ! I save the logged in user, the page where I, the
details, the recordID of the record they asked.

but when 2 users connect via internet with my page, the values get mixed up.
I have to say that I've developed a Customserver control and that is using
the state variable

Ton

"Patrice" <nobody@.nowhere.com> schreef in bericht
news:eZGEnYLGEHA.1720@.tk2msftngp13.phx.gbl...
> No other code than that ? It looks like it should work (of course all
users
> will have the same connect value if you store always FKHFSF for all
users).
> What if you are using directly System.Web.HttpContext.Current.Session.
> Other than that , it would like as if you were using a shared property
> somewhere...
> Patrice
>
> "ton" <vrs@.REMOVEhome.nl> a crit dans le message de
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> > Hi,
> > I keep several variables in a statevalue like:
> > Dim session As SessionState.HttpSessionState =
> > System.Web.HttpContext.Current.Session
> > session("connect") = " FKHFSF "
> > I thought that these variables would be the exclusive use of one
connected
> > user/connection. But it looks like that in a multiuser enviroment some
> > variables are shared. So I end on the page somenone else was editing.
> > What am I missing here. (I have not modified any property of the session
> > variable)
> > Ton
No other code than that ! I save the logged in user, the page where I, the
details, the recordID of the record they asked.

but when 2 users connect via internet with my page, the values get mixed up.
I have to say that I've developed a Customserver control and that is using
the state variable

Ton

"Patrice" <nobody@.nowhere.com> schreef in bericht
news:eZGEnYLGEHA.1720@.tk2msftngp13.phx.gbl...
> No other code than that ? It looks like it should work (of course all
users
> will have the same connect value if you store always FKHFSF for all
users).
> What if you are using directly System.Web.HttpContext.Current.Session.
> Other than that , it would like as if you were using a shared property
> somewhere...
> Patrice
>
> "ton" <vrs@.REMOVEhome.nl> a crit dans le message de
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> > Hi,
> > I keep several variables in a statevalue like:
> > Dim session As SessionState.HttpSessionState =
> > System.Web.HttpContext.Current.Session
> > session("connect") = " FKHFSF "
> > I thought that these variables would be the exclusive use of one
connected
> > user/connection. But it looks like that in a multiuser enviroment some
> > variables are shared. So I end on the page somenone else was editing.
> > What am I missing here. (I have not modified any property of the session
> > variable)
> > Ton

Session variable are shared between users

Hi,
I keep several variables in a statevalue like:
Dim session As SessionState.HttpSessionState =
System.Web.HttpContext.Current.Session

session("connect") = " FKHFSF "

I thought that these variables would be the exclusive use of one connected
user/connection. But it looks like that in a multiuser enviroment some
variables are shared. So I end on the page somenone else was editing.

What am I missing here. (I have not modified any property of the session
variable)

TonNo other code than that ? It looks like it should work (of course all users
will have the same connect value if you store always FKHFSF for all users).
What if you are using directly System.Web.HttpContext.Current.Session.

Other than that , it would like as if you were using a shared property
somewhere...

Patrice

"ton" <vrs@.REMOVEhome.nl> a crit dans le message de
news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> Hi,
> I keep several variables in a statevalue like:
> Dim session As SessionState.HttpSessionState =
> System.Web.HttpContext.Current.Session
> session("connect") = " FKHFSF "
> I thought that these variables would be the exclusive use of one connected
> user/connection. But it looks like that in a multiuser enviroment some
> variables are shared. So I end on the page somenone else was editing.
> What am I missing here. (I have not modified any property of the session
> variable)
> Ton
No other code than that ! I save the logged in user, the page where I, the
details, the recordID of the record they asked.

but when 2 users connect via internet with my page, the values get mixed up.
I have to say that I've developed a Customserver control and that is using
the state variable

Ton

"Patrice" <nobody@.nowhere.com> schreef in bericht
news:eZGEnYLGEHA.1720@.tk2msftngp13.phx.gbl...
> No other code than that ? It looks like it should work (of course all
users
> will have the same connect value if you store always FKHFSF for all
users).
> What if you are using directly System.Web.HttpContext.Current.Session.
> Other than that , it would like as if you were using a shared property
> somewhere...
> Patrice
>
> "ton" <vrs@.REMOVEhome.nl> a crit dans le message de
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> > Hi,
> > I keep several variables in a statevalue like:
> > Dim session As SessionState.HttpSessionState =
> > System.Web.HttpContext.Current.Session
> > session("connect") = " FKHFSF "
> > I thought that these variables would be the exclusive use of one
connected
> > user/connection. But it looks like that in a multiuser enviroment some
> > variables are shared. So I end on the page somenone else was editing.
> > What am I missing here. (I have not modified any property of the session
> > variable)
> > Ton
No other code than that ! I save the logged in user, the page where I, the
details, the recordID of the record they asked.

but when 2 users connect via internet with my page, the values get mixed up.
I have to say that I've developed a Customserver control and that is using
the state variable

Ton

"Patrice" <nobody@.nowhere.com> schreef in bericht
news:eZGEnYLGEHA.1720@.tk2msftngp13.phx.gbl...
> No other code than that ? It looks like it should work (of course all
users
> will have the same connect value if you store always FKHFSF for all
users).
> What if you are using directly System.Web.HttpContext.Current.Session.
> Other than that , it would like as if you were using a shared property
> somewhere...
> Patrice
>
> "ton" <vrs@.REMOVEhome.nl> a crit dans le message de
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> > Hi,
> > I keep several variables in a statevalue like:
> > Dim session As SessionState.HttpSessionState =
> > System.Web.HttpContext.Current.Session
> > session("connect") = " FKHFSF "
> > I thought that these variables would be the exclusive use of one
connected
> > user/connection. But it looks like that in a multiuser enviroment some
> > variables are shared. So I end on the page somenone else was editing.
> > What am I missing here. (I have not modified any property of the session
> > variable)
> > Ton
Ho do you test the multi-user environment?
Do you just open up the second browser?
If you opening it by using new window then you get the same session.
It's by design (of Browser).

Try to do the real test. From 2 different machines for example.

I can assure you that it works (unless your system is messed up big time)

George.

"ton" <vrs@.REMOVEhome.nl> wrote in message
news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> Hi,
> I keep several variables in a statevalue like:
> Dim session As SessionState.HttpSessionState =
> System.Web.HttpContext.Current.Session
> session("connect") = " FKHFSF "
> I thought that these variables would be the exclusive use of one connected
> user/connection. But it looks like that in a multiuser enviroment some
> variables are shared. So I end on the page somenone else was editing.
> What am I missing here. (I have not modified any property of the session
> variable)
> Ton
it does not work on a second system.
But I've solved it allready. It looks that using sessionstate variables in a
customserver control is not reliable.
I've changed it to viewstate and now it works. Allthough I have to save de
logon values in a sessionstate, then when opening the second page (with
another customservercontrol) I read the sessionstate variable and save them
in viewstate. With these variabele I keep on using without any problem when
other users are opening the same page.

ton

"George Ter-Saakov" <nospam@.hotmail.com> schreef in bericht
news:eiLqniwGEHA.3068@.TK2MSFTNGP11.phx.gbl...
> Ho do you test the multi-user environment?
> Do you just open up the second browser?
> If you opening it by using new window then you get the same session.
> It's by design (of Browser).
> Try to do the real test. From 2 different machines for example.
> I can assure you that it works (unless your system is messed up big time)
> George.
> "ton" <vrs@.REMOVEhome.nl> wrote in message
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> > Hi,
> > I keep several variables in a statevalue like:
> > Dim session As SessionState.HttpSessionState =
> > System.Web.HttpContext.Current.Session
> > session("connect") = " FKHFSF "
> > I thought that these variables would be the exclusive use of one
connected
> > user/connection. But it looks like that in a multiuser enviroment some
> > variables are shared. So I end on the page somenone else was editing.
> > What am I missing here. (I have not modified any property of the session
> > variable)
> > Ton

Session variable are shared between users

Hi,
I keep several variables in a statevalue like:
Dim session As SessionState.HttpSessionState =
System.Web.HttpContext.Current.Session

session("connect") = " FKHFSF "

I thought that these variables would be the exclusive use of one connected
user/connection. But it looks like that in a multiuser enviroment some
variables are shared. So I end on the page somenone else was editing.

What am I missing here. (I have not modified any property of the session
variable)

TonNo other code than that ? It looks like it should work (of course all users
will have the same connect value if you store always FKHFSF for all users).
What if you are using directly System.Web.HttpContext.Current.Session.

Other than that , it would like as if you were using a shared property
somewhere...

Patrice

"ton" <vrs@.REMOVEhome.nl> a crit dans le message de
news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> Hi,
> I keep several variables in a statevalue like:
> Dim session As SessionState.HttpSessionState =
> System.Web.HttpContext.Current.Session
> session("connect") = " FKHFSF "
> I thought that these variables would be the exclusive use of one connected
> user/connection. But it looks like that in a multiuser enviroment some
> variables are shared. So I end on the page somenone else was editing.
> What am I missing here. (I have not modified any property of the session
> variable)
> Ton
No other code than that ! I save the logged in user, the page where I, the
details, the recordID of the record they asked.

but when 2 users connect via internet with my page, the values get mixed up.
I have to say that I've developed a Customserver control and that is using
the state variable

Ton

"Patrice" <nobody@.nowhere.com> schreef in bericht
news:eZGEnYLGEHA.1720@.tk2msftngp13.phx.gbl...
> No other code than that ? It looks like it should work (of course all
users
> will have the same connect value if you store always FKHFSF for all
users).
> What if you are using directly System.Web.HttpContext.Current.Session.
> Other than that , it would like as if you were using a shared property
> somewhere...
> Patrice
>
> "ton" <vrs@.REMOVEhome.nl> a crit dans le message de
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> > Hi,
> > I keep several variables in a statevalue like:
> > Dim session As SessionState.HttpSessionState =
> > System.Web.HttpContext.Current.Session
> > session("connect") = " FKHFSF "
> > I thought that these variables would be the exclusive use of one
connected
> > user/connection. But it looks like that in a multiuser enviroment some
> > variables are shared. So I end on the page somenone else was editing.
> > What am I missing here. (I have not modified any property of the session
> > variable)
> > Ton
No other code than that ! I save the logged in user, the page where I, the
details, the recordID of the record they asked.

but when 2 users connect via internet with my page, the values get mixed up.
I have to say that I've developed a Customserver control and that is using
the state variable

Ton

"Patrice" <nobody@.nowhere.com> schreef in bericht
news:eZGEnYLGEHA.1720@.tk2msftngp13.phx.gbl...
> No other code than that ? It looks like it should work (of course all
users
> will have the same connect value if you store always FKHFSF for all
users).
> What if you are using directly System.Web.HttpContext.Current.Session.
> Other than that , it would like as if you were using a shared property
> somewhere...
> Patrice
>
> "ton" <vrs@.REMOVEhome.nl> a crit dans le message de
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> > Hi,
> > I keep several variables in a statevalue like:
> > Dim session As SessionState.HttpSessionState =
> > System.Web.HttpContext.Current.Session
> > session("connect") = " FKHFSF "
> > I thought that these variables would be the exclusive use of one
connected
> > user/connection. But it looks like that in a multiuser enviroment some
> > variables are shared. So I end on the page somenone else was editing.
> > What am I missing here. (I have not modified any property of the session
> > variable)
> > Ton
Ho do you test the multi-user environment?
Do you just open up the second browser?
If you opening it by using new window then you get the same session.
It's by design (of Browser).

Try to do the real test. From 2 different machines for example.

I can assure you that it works (unless your system is messed up big time)

George.

"ton" <vrs@.REMOVEhome.nl> wrote in message
news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> Hi,
> I keep several variables in a statevalue like:
> Dim session As SessionState.HttpSessionState =
> System.Web.HttpContext.Current.Session
> session("connect") = " FKHFSF "
> I thought that these variables would be the exclusive use of one connected
> user/connection. But it looks like that in a multiuser enviroment some
> variables are shared. So I end on the page somenone else was editing.
> What am I missing here. (I have not modified any property of the session
> variable)
> Ton
it does not work on a second system.
But I've solved it allready. It looks that using sessionstate variables in a
customserver control is not reliable.
I've changed it to viewstate and now it works. Allthough I have to save de
logon values in a sessionstate, then when opening the second page (with
another customservercontrol) I read the sessionstate variable and save them
in viewstate. With these variabele I keep on using without any problem when
other users are opening the same page.

ton

"George Ter-Saakov" <nospam@.hotmail.com> schreef in bericht
news:eiLqniwGEHA.3068@.TK2MSFTNGP11.phx.gbl...
> Ho do you test the multi-user environment?
> Do you just open up the second browser?
> If you opening it by using new window then you get the same session.
> It's by design (of Browser).
> Try to do the real test. From 2 different machines for example.
> I can assure you that it works (unless your system is messed up big time)
> George.
> "ton" <vrs@.REMOVEhome.nl> wrote in message
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> > Hi,
> > I keep several variables in a statevalue like:
> > Dim session As SessionState.HttpSessionState =
> > System.Web.HttpContext.Current.Session
> > session("connect") = " FKHFSF "
> > I thought that these variables would be the exclusive use of one
connected
> > user/connection. But it looks like that in a multiuser enviroment some
> > variables are shared. So I end on the page somenone else was editing.
> > What am I missing here. (I have not modified any property of the session
> > variable)
> > Ton

Session variable are shared between users

Hi,
I keep several variables in a statevalue like:
Dim session As SessionState.HttpSessionState =
System.Web.HttpContext.Current.Session
session("connect") = " FKHFSF "
I thought that these variables would be the exclusive use of one connected
user/connection. But it looks like that in a multiuser enviroment some
variables are shared. So I end on the page somenone else was editing.
What am I missing here. (I have not modified any property of the session
variable)
TonNo other code than that ? It looks like it should work (of course all users
will have the same connect value if you store always FKHFSF for all users).
What if you are using directly System.Web.HttpContext.Current.Session.
Other than that , it would like as if you were using a shared property
somewhere...
Patrice
"ton" <vrs@.REMOVEhome.nl> a crit dans le message de
news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> Hi,
> I keep several variables in a statevalue like:
> Dim session As SessionState.HttpSessionState =
> System.Web.HttpContext.Current.Session
> session("connect") = " FKHFSF "
> I thought that these variables would be the exclusive use of one connected
> user/connection. But it looks like that in a multiuser enviroment some
> variables are shared. So I end on the page somenone else was editing.
> What am I missing here. (I have not modified any property of the session
> variable)
> Ton
>
No other code than that ! I save the logged in user, the page where I, the
details, the recordID of the record they asked.
but when 2 users connect via internet with my page, the values get mixed up.
I have to say that I've developed a Customserver control and that is using
the state variable
Ton
"Patrice" <nobody@.nowhere.com> schreef in bericht
news:eZGEnYLGEHA.1720@.tk2msftngp13.phx.gbl...
> No other code than that ? It looks like it should work (of course all
users
> will have the same connect value if you store always FKHFSF for all
users).
> What if you are using directly System.Web.HttpContext.Current.Session.
> Other than that , it would like as if you were using a shared property
> somewhere...
> Patrice
>
> "ton" <vrs@.REMOVEhome.nl> a crit dans le message de
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
connected
>
No other code than that ! I save the logged in user, the page where I, the
details, the recordID of the record they asked.
but when 2 users connect via internet with my page, the values get mixed up.
I have to say that I've developed a Customserver control and that is using
the state variable
Ton
"Patrice" <nobody@.nowhere.com> schreef in bericht
news:eZGEnYLGEHA.1720@.tk2msftngp13.phx.gbl...
> No other code than that ? It looks like it should work (of course all
users
> will have the same connect value if you store always FKHFSF for all
users).
> What if you are using directly System.Web.HttpContext.Current.Session.
> Other than that , it would like as if you were using a shared property
> somewhere...
> Patrice
>
> "ton" <vrs@.REMOVEhome.nl> a crit dans le message de
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
connected
>
Ho do you test the multi-user environment?
Do you just open up the second browser?
If you opening it by using new window then you get the same session.
It's by design (of Browser).
Try to do the real test. From 2 different machines for example.
I can assure you that it works (unless your system is messed up big time)
George.
"ton" <vrs@.REMOVEhome.nl> wrote in message
news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
> Hi,
> I keep several variables in a statevalue like:
> Dim session As SessionState.HttpSessionState =
> System.Web.HttpContext.Current.Session
> session("connect") = " FKHFSF "
> I thought that these variables would be the exclusive use of one connected
> user/connection. But it looks like that in a multiuser enviroment some
> variables are shared. So I end on the page somenone else was editing.
> What am I missing here. (I have not modified any property of the session
> variable)
> Ton
>
it does not work on a second system.
But I've solved it allready. It looks that using sessionstate variables in a
customserver control is not reliable.
I've changed it to viewstate and now it works. Allthough I have to save de
logon values in a sessionstate, then when opening the second page (with
another customservercontrol) I read the sessionstate variable and save them
in viewstate. With these variabele I keep on using without any problem when
other users are opening the same page.
ton
"George Ter-Saakov" <nospam@.hotmail.com> schreef in bericht
news:eiLqniwGEHA.3068@.TK2MSFTNGP11.phx.gbl...
> Ho do you test the multi-user environment?
> Do you just open up the second browser?
> If you opening it by using new window then you get the same session.
> It's by design (of Browser).
> Try to do the real test. From 2 different machines for example.
> I can assure you that it works (unless your system is messed up big time)
> George.
> "ton" <vrs@.REMOVEhome.nl> wrote in message
> news:c4jor3$68l$1@.news1.tilbu1.nb.home.nl...
connected
>

Monday, March 26, 2012

Session variable data being lost

Our website contains session variables that are used to validate if a user i
s
logged in etc. We have found that these variables are randomly lost while
navigating the website.
We set up some basic code (as shown below) which used a meta tag to refresh
an aspx page every second. It tests whether there is any content in a
session variable, if not then it writes a timestamp to a text file, recreate
s
the data in the variable and continues. As you can see this script contains
no databases calls etc.
<%response.write(session("Username") & "<br>" & Session.SessionID)
if len(session("Username"))=0 then
Dim FILENAME as String = Server.MapPath("Output.txt")
Dim objStreamWriter as StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine(DateTime.Now.ToString())
objStreamWriter.Close()
session("Username") = "HelloWorld"
end if %>
The output looks like this:
18/04/2006 15:08:18
18/04/2006 15:11:37
18/04/2006 15:18:39
18/04/2006 15:21:40
18/04/2006 15:31:41
18/04/2006 15:34:43
18/04/2006 15:41:44
18/04/2006 15:50:46
18/04/2006 15:56:49
18/04/2006 15:58:47
18/04/2006 16:03:50
18/04/2006 16:06:49
18/04/2006 16:08:49
18/04/2006 16:11:50
18/04/2006 16:14:55
18/04/2006 16:16:55
18/04/2006 16:18:54
18/04/2006 16:23:00
18/04/2006 16:26:00
18/04/2006 16:31:01
18/04/2006 16:35:03
18/04/2006 16:37:05
18/04/2006 16:39:04
18/04/2006 16:41:06
18/04/2006 16:43:12
18/04/2006 16:45:10
18/04/2006 16:50:09
As you can see the session data is dropped usually under 10 minutes but
completely randomly. We have also found that the session id stays the same.
I
assume the reason it does stay the same is because that specific data is hel
d
on the client and passed to the server on every communication to the server.
Our webhosting does not support Stateserver or SQLServer state management,
so the only option is InProc. From searching several articles we have found
there are many reasons why this data can be lost. For example if any .config
files or bin files are changed or touched (eg by AV software) then the
application resets and therefore loses the session data. This has also been
tested by us and can confirm this happens.
As our website is hosted on a shared server, we assume that other sites are
or could be having similar issues as us.
Has anyone experienced this particular issue before?
Thanks in advance.
Regards
Sarah Marriott.Tell your ISP to turn off the AV check.
"Sarah Marriott" <Sarah Marriott@.discussions.microsoft.com> wrote in message
news:11DF6E98-DF76-4995-90D4-D594FDADC120@.microsoft.com...
> Our website contains session variables that are used to validate if a user
> is
> logged in etc. We have found that these variables are randomly lost while
> navigating the website.
> We set up some basic code (as shown below) which used a meta tag to
> refresh
> an aspx page every second. It tests whether there is any content in a
> session variable, if not then it writes a timestamp to a text file,
> recreates
> the data in the variable and continues. As you can see this script
> contains
> no databases calls etc.
> <%response.write(session("Username") & "<br>" & Session.SessionID)
> if len(session("Username"))=0 then
> Dim FILENAME as String = Server.MapPath("Output.txt")
> Dim objStreamWriter as StreamWriter
> objStreamWriter = File.AppendText(FILENAME)
> objStreamWriter.WriteLine(DateTime.Now.ToString())
> objStreamWriter.Close()
> session("Username") = "HelloWorld"
> end if %>
> The output looks like this:
> 18/04/2006 15:08:18
> 18/04/2006 15:11:37
> 18/04/2006 15:18:39
> 18/04/2006 15:21:40
> 18/04/2006 15:31:41
> 18/04/2006 15:34:43
> 18/04/2006 15:41:44
> 18/04/2006 15:50:46
> 18/04/2006 15:56:49
> 18/04/2006 15:58:47
> 18/04/2006 16:03:50
> 18/04/2006 16:06:49
> 18/04/2006 16:08:49
> 18/04/2006 16:11:50
> 18/04/2006 16:14:55
> 18/04/2006 16:16:55
> 18/04/2006 16:18:54
> 18/04/2006 16:23:00
> 18/04/2006 16:26:00
> 18/04/2006 16:31:01
> 18/04/2006 16:35:03
> 18/04/2006 16:37:05
> 18/04/2006 16:39:04
> 18/04/2006 16:41:06
> 18/04/2006 16:43:12
> 18/04/2006 16:45:10
> 18/04/2006 16:50:09
> As you can see the session data is dropped usually under 10 minutes but
> completely randomly. We have also found that the session id stays the
> same. I
> assume the reason it does stay the same is because that specific data is
> held
> on the client and passed to the server on every communication to the
> server.
> Our webhosting does not support Stateserver or SQLServer state management,
> so the only option is InProc. From searching several articles we have
> found
> there are many reasons why this data can be lost. For example if any
> .config
> files or bin files are changed or touched (eg by AV software) then the
> application resets and therefore loses the session data. This has also
> been
> tested by us and can confirm this happens.
> As our website is hosted on a shared server, we assume that other sites
> are
> or could be having similar issues as us.
> Has anyone experienced this particular issue before?
> Thanks in advance.
> Regards
> Sarah Marriott.
Hi Jeff,
Sorry for the late reply - you know how ISPs are at getting back to you :)
We asked the questions, and they stated that AV doesn't actually run on
their webservers.
Any other ideas?
Regards
Sarah
"Jeff Dillon" wrote:

> Tell your ISP to turn off the AV check.
> "Sarah Marriott" <Sarah Marriott@.discussions.microsoft.com> wrote in messa
ge
> news:11DF6E98-DF76-4995-90D4-D594FDADC120@.microsoft.com...
>
>
I've been having strange problems for the past month, since going live
with a new site. (http://www.paintworldinc.com) At first I thought
these were user errors. As traffic has been steadily increasing, so
have these errors. They are EXACTLY as you describe. Sometimes, a user
will get as far as the checkout page, populate the form, then hit the
submit - that's when the system will throw an exception. I have code in
place to catch these errors, and write the exception.message text to
the database. They have been due to trying to insert a null into a
required database field - this is data that was held in a session
variable.
I was going to use persistent state - but my host provider does not yet
support it, although they might be turning this on as I write.
Aside from that, I may just implement my own custom session variable
store - using SQL Server as my storage.
If you solve this, please post back as to your own solution.
Regards,
-DG
Sarah Marriott wrote:
> Our website contains session variables that are used to validate if a user
is
> logged in etc. We have found that these variables are randomly lost while
> navigating the website.
> We set up some basic code (as shown below) which used a meta tag to refres
h
> an aspx page every second. It tests whether there is any content in a
> session variable, if not then it writes a timestamp to a text file, recrea
tes
> the data in the variable and continues. As you can see this script contain
s
> no databases calls etc.
> <%response.write(session("Username") & "<br>" & Session.SessionID)
> if len(session("Username"))=0 then
> Dim FILENAME as String = Server.MapPath("Output.txt")
> Dim objStreamWriter as StreamWriter
> objStreamWriter = File.AppendText(FILENAME)
> objStreamWriter.WriteLine(DateTime.Now.ToString())
> objStreamWriter.Close()
> session("Username") = "HelloWorld"
> end if %>
> The output looks like this:
> 18/04/2006 15:08:18
> 18/04/2006 15:11:37
> 18/04/2006 15:18:39
> 18/04/2006 15:21:40
> 18/04/2006 15:31:41
> 18/04/2006 15:34:43
> 18/04/2006 15:41:44
> 18/04/2006 15:50:46
> 18/04/2006 15:56:49
> 18/04/2006 15:58:47
> 18/04/2006 16:03:50
> 18/04/2006 16:06:49
> 18/04/2006 16:08:49
> 18/04/2006 16:11:50
> 18/04/2006 16:14:55
> 18/04/2006 16:16:55
> 18/04/2006 16:18:54
> 18/04/2006 16:23:00
> 18/04/2006 16:26:00
> 18/04/2006 16:31:01
> 18/04/2006 16:35:03
> 18/04/2006 16:37:05
> 18/04/2006 16:39:04
> 18/04/2006 16:41:06
> 18/04/2006 16:43:12
> 18/04/2006 16:45:10
> 18/04/2006 16:50:09
> As you can see the session data is dropped usually under 10 minutes but
> completely randomly. We have also found that the session id stays the same
. I
> assume the reason it does stay the same is because that specific data is h
eld
> on the client and passed to the server on every communication to the serve
r.
> Our webhosting does not support Stateserver or SQLServer state management,
> so the only option is InProc. From searching several articles we have foun
d
> there are many reasons why this data can be lost. For example if any .conf
ig
> files or bin files are changed or touched (eg by AV software) then the
> application resets and therefore loses the session data. This has also bee
n
> tested by us and can confirm this happens.
> As our website is hosted on a shared server, we assume that other sites ar
e
> or could be having similar issues as us.
> Has anyone experienced this particular issue before?
> Thanks in advance.
> Regards
> Sarah Marriott.
Hi,
Our ISP finally got back to us saying that this problem is due to our site
being held on a Server Farm. There is nothing they will do to resolve this
issue. So we have had to handle it by storing a flag in the db which the cod
e
checks if there is no session data available. If the flag has been set then
it re-establishes the session data. This is tedious and does result in more
calls to the db, but the site is more stable.
I'm guessing that you'll have to implement something similar or use the db
like you say.
This is rather annoying and I'm surprised more people are not complaining
about it. Maybe many people do not realise this is happening - scary!
Hope this helps.
Best regards,
Sarah
"dfgallucci@.gmail.com" wrote:

> I've been having strange problems for the past month, since going live
> with a new site. (http://www.paintworldinc.com) At first I thought
> these were user errors. As traffic has been steadily increasing, so
> have these errors. They are EXACTLY as you describe. Sometimes, a user
> will get as far as the checkout page, populate the form, then hit the
> submit - that's when the system will throw an exception. I have code in
> place to catch these errors, and write the exception.message text to
> the database. They have been due to trying to insert a null into a
> required database field - this is data that was held in a session
> variable.
> I was going to use persistent state - but my host provider does not yet
> support it, although they might be turning this on as I write.
> Aside from that, I may just implement my own custom session variable
> store - using SQL Server as my storage.
> If you solve this, please post back as to your own solution.
> Regards,
> -DG
>
> Sarah Marriott wrote:
>

Session variable data being lost

Our website contains session variables that are used to validate if a user is
logged in etc. We have found that these variables are randomly lost while
navigating the website.

We set up some basic code (as shown below) which used a meta tag to refresh
an aspx page every second. It tests whether there is any content in a
session variable, if not then it writes a timestamp to a text file, recreates
the data in the variable and continues. As you can see this script contains
no databases calls etc.

<%response.write(session("Username") & "<br>" & Session.SessionID)
if len(session("Username"))=0 then
Dim FILENAME as String = Server.MapPath("Output.txt")
Dim objStreamWriter as StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine(DateTime.Now.ToString())
objStreamWriter.Close()
session("Username") = "HelloWorld"
end if %
The output looks like this:
18/04/2006 15:08:18
18/04/2006 15:11:37
18/04/2006 15:18:39
18/04/2006 15:21:40
18/04/2006 15:31:41
18/04/2006 15:34:43
18/04/2006 15:41:44
18/04/2006 15:50:46
18/04/2006 15:56:49
18/04/2006 15:58:47
18/04/2006 16:03:50
18/04/2006 16:06:49
18/04/2006 16:08:49
18/04/2006 16:11:50
18/04/2006 16:14:55
18/04/2006 16:16:55
18/04/2006 16:18:54
18/04/2006 16:23:00
18/04/2006 16:26:00
18/04/2006 16:31:01
18/04/2006 16:35:03
18/04/2006 16:37:05
18/04/2006 16:39:04
18/04/2006 16:41:06
18/04/2006 16:43:12
18/04/2006 16:45:10
18/04/2006 16:50:09

As you can see the session data is dropped usually under 10 minutes but
completely randomly. We have also found that the session id stays the same. I
assume the reason it does stay the same is because that specific data is held
on the client and passed to the server on every communication to the server.

Our webhosting does not support Stateserver or SQLServer state management,
so the only option is InProc. From searching several articles we have found
there are many reasons why this data can be lost. For example if any .config
files or bin files are changed or touched (eg by AV software) then the
application resets and therefore loses the session data. This has also been
tested by us and can confirm this happens.

As our website is hosted on a shared server, we assume that other sites are
or could be having similar issues as us.

Has anyone experienced this particular issue before?

Thanks in advance.

Regards

Sarah Marriott.Tell your ISP to turn off the AV check.

"Sarah Marriott" <Sarah Marriott@.discussions.microsoft.com> wrote in message
news:11DF6E98-DF76-4995-90D4-D594FDADC120@.microsoft.com...
> Our website contains session variables that are used to validate if a user
> is
> logged in etc. We have found that these variables are randomly lost while
> navigating the website.
> We set up some basic code (as shown below) which used a meta tag to
> refresh
> an aspx page every second. It tests whether there is any content in a
> session variable, if not then it writes a timestamp to a text file,
> recreates
> the data in the variable and continues. As you can see this script
> contains
> no databases calls etc.
> <%response.write(session("Username") & "<br>" & Session.SessionID)
> if len(session("Username"))=0 then
> Dim FILENAME as String = Server.MapPath("Output.txt")
> Dim objStreamWriter as StreamWriter
> objStreamWriter = File.AppendText(FILENAME)
> objStreamWriter.WriteLine(DateTime.Now.ToString())
> objStreamWriter.Close()
> session("Username") = "HelloWorld"
> end if %>
> The output looks like this:
> 18/04/2006 15:08:18
> 18/04/2006 15:11:37
> 18/04/2006 15:18:39
> 18/04/2006 15:21:40
> 18/04/2006 15:31:41
> 18/04/2006 15:34:43
> 18/04/2006 15:41:44
> 18/04/2006 15:50:46
> 18/04/2006 15:56:49
> 18/04/2006 15:58:47
> 18/04/2006 16:03:50
> 18/04/2006 16:06:49
> 18/04/2006 16:08:49
> 18/04/2006 16:11:50
> 18/04/2006 16:14:55
> 18/04/2006 16:16:55
> 18/04/2006 16:18:54
> 18/04/2006 16:23:00
> 18/04/2006 16:26:00
> 18/04/2006 16:31:01
> 18/04/2006 16:35:03
> 18/04/2006 16:37:05
> 18/04/2006 16:39:04
> 18/04/2006 16:41:06
> 18/04/2006 16:43:12
> 18/04/2006 16:45:10
> 18/04/2006 16:50:09
> As you can see the session data is dropped usually under 10 minutes but
> completely randomly. We have also found that the session id stays the
> same. I
> assume the reason it does stay the same is because that specific data is
> held
> on the client and passed to the server on every communication to the
> server.
> Our webhosting does not support Stateserver or SQLServer state management,
> so the only option is InProc. From searching several articles we have
> found
> there are many reasons why this data can be lost. For example if any
> .config
> files or bin files are changed or touched (eg by AV software) then the
> application resets and therefore loses the session data. This has also
> been
> tested by us and can confirm this happens.
> As our website is hosted on a shared server, we assume that other sites
> are
> or could be having similar issues as us.
> Has anyone experienced this particular issue before?
> Thanks in advance.
> Regards
> Sarah Marriott.
Hi Jeff,

Sorry for the late reply - you know how ISPs are at getting back to you :)

We asked the questions, and they stated that AV doesn't actually run on
their webservers.

Any other ideas?

Regards

Sarah

"Jeff Dillon" wrote:

> Tell your ISP to turn off the AV check.
> "Sarah Marriott" <Sarah Marriott@.discussions.microsoft.com> wrote in message
> news:11DF6E98-DF76-4995-90D4-D594FDADC120@.microsoft.com...
> > Our website contains session variables that are used to validate if a user
> > is
> > logged in etc. We have found that these variables are randomly lost while
> > navigating the website.
> > We set up some basic code (as shown below) which used a meta tag to
> > refresh
> > an aspx page every second. It tests whether there is any content in a
> > session variable, if not then it writes a timestamp to a text file,
> > recreates
> > the data in the variable and continues. As you can see this script
> > contains
> > no databases calls etc.
> > <%response.write(session("Username") & "<br>" & Session.SessionID)
> > if len(session("Username"))=0 then
> > Dim FILENAME as String = Server.MapPath("Output.txt")
> > Dim objStreamWriter as StreamWriter
> > objStreamWriter = File.AppendText(FILENAME)
> > objStreamWriter.WriteLine(DateTime.Now.ToString())
> > objStreamWriter.Close()
> > session("Username") = "HelloWorld"
> > end if %>
> > The output looks like this:
> > 18/04/2006 15:08:18
> > 18/04/2006 15:11:37
> > 18/04/2006 15:18:39
> > 18/04/2006 15:21:40
> > 18/04/2006 15:31:41
> > 18/04/2006 15:34:43
> > 18/04/2006 15:41:44
> > 18/04/2006 15:50:46
> > 18/04/2006 15:56:49
> > 18/04/2006 15:58:47
> > 18/04/2006 16:03:50
> > 18/04/2006 16:06:49
> > 18/04/2006 16:08:49
> > 18/04/2006 16:11:50
> > 18/04/2006 16:14:55
> > 18/04/2006 16:16:55
> > 18/04/2006 16:18:54
> > 18/04/2006 16:23:00
> > 18/04/2006 16:26:00
> > 18/04/2006 16:31:01
> > 18/04/2006 16:35:03
> > 18/04/2006 16:37:05
> > 18/04/2006 16:39:04
> > 18/04/2006 16:41:06
> > 18/04/2006 16:43:12
> > 18/04/2006 16:45:10
> > 18/04/2006 16:50:09
> > As you can see the session data is dropped usually under 10 minutes but
> > completely randomly. We have also found that the session id stays the
> > same. I
> > assume the reason it does stay the same is because that specific data is
> > held
> > on the client and passed to the server on every communication to the
> > server.
> > Our webhosting does not support Stateserver or SQLServer state management,
> > so the only option is InProc. From searching several articles we have
> > found
> > there are many reasons why this data can be lost. For example if any
> > .config
> > files or bin files are changed or touched (eg by AV software) then the
> > application resets and therefore loses the session data. This has also
> > been
> > tested by us and can confirm this happens.
> > As our website is hosted on a shared server, we assume that other sites
> > are
> > or could be having similar issues as us.
> > Has anyone experienced this particular issue before?
> > Thanks in advance.
> > Regards
> > Sarah Marriott.
>
I've been having strange problems for the past month, since going live
with a new site. (http://www.paintworldinc.com) At first I thought
these were user errors. As traffic has been steadily increasing, so
have these errors. They are EXACTLY as you describe. Sometimes, a user
will get as far as the checkout page, populate the form, then hit the
submit - that's when the system will throw an exception. I have code in
place to catch these errors, and write the exception.message text to
the database. They have been due to trying to insert a null into a
required database field - this is data that was held in a session
variable.

I was going to use persistent state - but my host provider does not yet
support it, although they might be turning this on as I write.

Aside from that, I may just implement my own custom session variable
store - using SQL Server as my storage.

If you solve this, please post back as to your own solution.

Regards,

-DG

Sarah Marriott wrote:
> Our website contains session variables that are used to validate if a user is
> logged in etc. We have found that these variables are randomly lost while
> navigating the website.
> We set up some basic code (as shown below) which used a meta tag to refresh
> an aspx page every second. It tests whether there is any content in a
> session variable, if not then it writes a timestamp to a text file, recreates
> the data in the variable and continues. As you can see this script contains
> no databases calls etc.
> <%response.write(session("Username") & "<br>" & Session.SessionID)
> if len(session("Username"))=0 then
> Dim FILENAME as String = Server.MapPath("Output.txt")
> Dim objStreamWriter as StreamWriter
> objStreamWriter = File.AppendText(FILENAME)
> objStreamWriter.WriteLine(DateTime.Now.ToString())
> objStreamWriter.Close()
> session("Username") = "HelloWorld"
> end if %>
> The output looks like this:
> 18/04/2006 15:08:18
> 18/04/2006 15:11:37
> 18/04/2006 15:18:39
> 18/04/2006 15:21:40
> 18/04/2006 15:31:41
> 18/04/2006 15:34:43
> 18/04/2006 15:41:44
> 18/04/2006 15:50:46
> 18/04/2006 15:56:49
> 18/04/2006 15:58:47
> 18/04/2006 16:03:50
> 18/04/2006 16:06:49
> 18/04/2006 16:08:49
> 18/04/2006 16:11:50
> 18/04/2006 16:14:55
> 18/04/2006 16:16:55
> 18/04/2006 16:18:54
> 18/04/2006 16:23:00
> 18/04/2006 16:26:00
> 18/04/2006 16:31:01
> 18/04/2006 16:35:03
> 18/04/2006 16:37:05
> 18/04/2006 16:39:04
> 18/04/2006 16:41:06
> 18/04/2006 16:43:12
> 18/04/2006 16:45:10
> 18/04/2006 16:50:09
> As you can see the session data is dropped usually under 10 minutes but
> completely randomly. We have also found that the session id stays the same. I
> assume the reason it does stay the same is because that specific data is held
> on the client and passed to the server on every communication to the server.
> Our webhosting does not support Stateserver or SQLServer state management,
> so the only option is InProc. From searching several articles we have found
> there are many reasons why this data can be lost. For example if any .config
> files or bin files are changed or touched (eg by AV software) then the
> application resets and therefore loses the session data. This has also been
> tested by us and can confirm this happens.
> As our website is hosted on a shared server, we assume that other sites are
> or could be having similar issues as us.
> Has anyone experienced this particular issue before?
> Thanks in advance.
> Regards
> Sarah Marriott.
Hi,

Our ISP finally got back to us saying that this problem is due to our site
being held on a Server Farm. There is nothing they will do to resolve this
issue. So we have had to handle it by storing a flag in the db which the code
checks if there is no session data available. If the flag has been set then
it re-establishes the session data. This is tedious and does result in more
calls to the db, but the site is more stable.

I'm guessing that you'll have to implement something similar or use the db
like you say.

This is rather annoying and I'm surprised more people are not complaining
about it. Maybe many people do not realise this is happening - scary!

Hope this helps.

Best regards,

Sarah

"dfgallucci@.gmail.com" wrote:

> I've been having strange problems for the past month, since going live
> with a new site. (http://www.paintworldinc.com) At first I thought
> these were user errors. As traffic has been steadily increasing, so
> have these errors. They are EXACTLY as you describe. Sometimes, a user
> will get as far as the checkout page, populate the form, then hit the
> submit - that's when the system will throw an exception. I have code in
> place to catch these errors, and write the exception.message text to
> the database. They have been due to trying to insert a null into a
> required database field - this is data that was held in a session
> variable.
> I was going to use persistent state - but my host provider does not yet
> support it, although they might be turning this on as I write.
> Aside from that, I may just implement my own custom session variable
> store - using SQL Server as my storage.
> If you solve this, please post back as to your own solution.
> Regards,
> -DG
>
> Sarah Marriott wrote:
> > Our website contains session variables that are used to validate if a user is
> > logged in etc. We have found that these variables are randomly lost while
> > navigating the website.
> > We set up some basic code (as shown below) which used a meta tag to refresh
> > an aspx page every second. It tests whether there is any content in a
> > session variable, if not then it writes a timestamp to a text file, recreates
> > the data in the variable and continues. As you can see this script contains
> > no databases calls etc.
> > <%response.write(session("Username") & "<br>" & Session.SessionID)
> > if len(session("Username"))=0 then
> > Dim FILENAME as String = Server.MapPath("Output.txt")
> > Dim objStreamWriter as StreamWriter
> > objStreamWriter = File.AppendText(FILENAME)
> > objStreamWriter.WriteLine(DateTime.Now.ToString())
> > objStreamWriter.Close()
> > session("Username") = "HelloWorld"
> > end if %>
> > The output looks like this:
> > 18/04/2006 15:08:18
> > 18/04/2006 15:11:37
> > 18/04/2006 15:18:39
> > 18/04/2006 15:21:40
> > 18/04/2006 15:31:41
> > 18/04/2006 15:34:43
> > 18/04/2006 15:41:44
> > 18/04/2006 15:50:46
> > 18/04/2006 15:56:49
> > 18/04/2006 15:58:47
> > 18/04/2006 16:03:50
> > 18/04/2006 16:06:49
> > 18/04/2006 16:08:49
> > 18/04/2006 16:11:50
> > 18/04/2006 16:14:55
> > 18/04/2006 16:16:55
> > 18/04/2006 16:18:54
> > 18/04/2006 16:23:00
> > 18/04/2006 16:26:00
> > 18/04/2006 16:31:01
> > 18/04/2006 16:35:03
> > 18/04/2006 16:37:05
> > 18/04/2006 16:39:04
> > 18/04/2006 16:41:06
> > 18/04/2006 16:43:12
> > 18/04/2006 16:45:10
> > 18/04/2006 16:50:09
> > As you can see the session data is dropped usually under 10 minutes but
> > completely randomly. We have also found that the session id stays the same. I
> > assume the reason it does stay the same is because that specific data is held
> > on the client and passed to the server on every communication to the server.
> > Our webhosting does not support Stateserver or SQLServer state management,
> > so the only option is InProc. From searching several articles we have found
> > there are many reasons why this data can be lost. For example if any .config
> > files or bin files are changed or touched (eg by AV software) then the
> > application resets and therefore loses the session data. This has also been
> > tested by us and can confirm this happens.
> > As our website is hosted on a shared server, we assume that other sites are
> > or could be having similar issues as us.
> > Has anyone experienced this particular issue before?
> > Thanks in advance.
> > Regards
> > Sarah Marriott.
>

Session Variable Data Type

Hi

I wanna know what is the datatype of the session variables. Can session variable be Integer or string
for examlple, is it true to right
session("v1")=1
or it must be
session("v1")= "1"

RegardsHello there,
Why dont you check the type of the session variable before assigning it; using
something like this:


Session("v1").GetType()

Cheerz
You can lookup the HttpSessionState object's propertieshere.

You'll find that theItem property is of type Object.

Therefore, session variables can have any data type, Integer, String, or even a DataSet for example (although you should keep the size of session as small as possible).

Jos
Session returns or sets an object value, so an object can be either, in each of their appropriate formats. If you have option explicit set to on, you will have to convert the session value to the appropriate type when retrieving the value FROM the session.

Brian
Session can be used to store any object type. When retrieving from session, the object must be cast to its original type before it is used. Here are some examples:


'Storing in session:
Session("v1") = 1
Session("v2") = "This is a string"
Dim ht As Hashtable = GetUsersInRole ("Administrators")
Session("v3") = ht

'Retrieving from session:
Dim var1 As Integer = CInt(Session("v1"))
Dim var2 As String = CStr(Session("v2"))
Dim var3 As HashTable = CType(Session("v3"), Hashtable)

Session variable losing value

I have an asp.net web application that uses session variables to store
user information (username, security areas, configuration data). When
the user logs into the system I store all of this information in a
class and then dump it into a session variable. The timeout on the
server is set to 2hrs. Every now and then (5min-30min) the web server
will lose the session variable. This is very inconsistent and doesn't
appear to have an associated pattern. Has anyone else come across this
issue and determined the root cause?
I've found a lot of posts that describe this issue but none that
actually pinpoint the cause or solution.

Please don't recommend that I use cookies, some other solution or
question why I'm storing this information in a session variable. The
application is structured in this way to meet specific user/regulatory
requirements and user imposed constraints.

Thanks!
NateAre you sure that the user keeps interacting with your web site for 2 hrs
after he logs in? Typically, I guess you maintain one session class object
per user and populates this class once the user logs in. Once the user
terminates his session (by logging out and closing the browser), it is lost.
That is how a session is defined logically.

"Nate Spillson" <nateusenet@.spillson.com> wrote in message
news:1ce32cdf.0308060908.7944a2b@.posting.google.co m...
> I have an asp.net web application that uses session variables to store
> user information (username, security areas, configuration data). When
> the user logs into the system I store all of this information in a
> class and then dump it into a session variable. The timeout on the
> server is set to 2hrs. Every now and then (5min-30min) the web server
> will lose the session variable. This is very inconsistent and doesn't
> appear to have an associated pattern. Has anyone else come across this
> issue and determined the root cause?
> I've found a lot of posts that describe this issue but none that
> actually pinpoint the cause or solution.
> Please don't recommend that I use cookies, some other solution or
> question why I'm storing this information in a session variable. The
> application is structured in this way to meet specific user/regulatory
> requirements and user imposed constraints.
> Thanks!
> Nate
It really depends on what you mean by "logging out and closing the browser".
If there is code to call Session.Abandon() in the sign out code, then yes,
this ends the session. But you don't know if there is.

Simply closing the browser does not end the session. The session continues
until the timeout.

However, any new browser instances will create a new session - while the
original one is still alive until the timeout occurrs.

Things that can occur an applications restart:
1) chaging DLL's, web.config, etc on the server
2) certain antivirus scanners that scan the above files, thus triggering a
restart

"Rao TRN" <trn_study@.hotmail.com> wrote in message
news:%23cJ6n9DXDHA.2620@.TK2MSFTNGP09.phx.gbl...
> Are you sure that the user keeps interacting with your web site for 2 hrs
> after he logs in? Typically, I guess you maintain one session class object
> per user and populates this class once the user logs in. Once the user
> terminates his session (by logging out and closing the browser), it is
lost.
> That is how a session is defined logically.
> "Nate Spillson" <nateusenet@.spillson.com> wrote in message
> news:1ce32cdf.0308060908.7944a2b@.posting.google.co m...
> > I have an asp.net web application that uses session variables to store
> > user information (username, security areas, configuration data). When
> > the user logs into the system I store all of this information in a
> > class and then dump it into a session variable. The timeout on the
> > server is set to 2hrs. Every now and then (5min-30min) the web server
> > will lose the session variable. This is very inconsistent and doesn't
> > appear to have an associated pattern. Has anyone else come across this
> > issue and determined the root cause?
> > I've found a lot of posts that describe this issue but none that
> > actually pinpoint the cause or solution.
> > Please don't recommend that I use cookies, some other solution or
> > question why I'm storing this information in a session variable. The
> > application is structured in this way to meet specific user/regulatory
> > requirements and user imposed constraints.
> > Thanks!
> > Nate

Session Variable not passed to new window

I have a number of Session variables that are not passing to a new
window. It is only happeneing on one user's computer and only under
her profile. Methods are called to obtain these values and re-assign
them to the Session if they = Nothing, except the UserID variable. If
this value is nothing then the window is closed and they are taken to
the login page.
I don't want to re-write the app to obtain this variable from another
method. So I've been busting my brain trying to find a way to write
the "UserID" value to a hidden input control and some how passing that
to the new window, but I can't get the server to see this value.
Any thoughts?bump

Session Variable not passed to new window

I have a number of Session variables that are not passing to a new
window. It is only happeneing on one user's computer and only under
her profile. Methods are called to obtain these values and re-assign
them to the Session if they = Nothing, except the UserID variable. If
this value is nothing then the window is closed and they are taken to
the login page.
I don't want to re-write the app to obtain this variable from another
method. So I've been busting my brain trying to find a way to write
the "UserID" value to a hidden input control and some how passing that
to the new window, but I can't get the server to see this value.
Any thoughts?bump

Saturday, March 24, 2012

session variable only accessable through page behind class instance?

Are session variables available to any class instance within a project namespace or only for use for the form codebehind class?

I have tried to set a session variable on a code behind class and then retrieve its value in a class instance used by the codebehind class and I get errors. Maybe I'm just not meant to access that way and only codebehind classes (classes that inherit System.Web.UI.Page) can use them?As far as I know session variables are only available in aspx pages.

That does not prevent you from passing value of your session variables to any of your business tier objects.
It's more a question of context.
Within the context of the ASP.NET process, any class can get to the session using HttpContext.Current.Session.
Thanks very much for the help!

Session variable problem

Greetings!

We are having a problem with Session variables in our .net application
that I hope someone can assist with.

our application stores UserIDs in a session variable at login. We have
an "inbox" aspx page that store user's messages in SQL Server. The
stored procedure uses to populate inbox uses the Session("UserID") to
pull the user's messages. Somehow UserA is bringing back UserB's
messages.

This problem isn't limited to the inbox aspx page, but to any page that
uses Session variables.

Any help would be much appreciated. If you need more info, please let
me know.

Best Regards,
Gene

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Are you using a clustered environment by any chance?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.

"Gene" <mooola@.yahoo.com> wrote in message
news:OYuKV80aDHA.3360@.tk2msftngp13.phx.gbl...
> Greetings!
> We are having a problem with Session variables in our .net application
> that I hope someone can assist with.
> our application stores UserIDs in a session variable at login. We have
> an "inbox" aspx page that store user's messages in SQL Server. The
> stored procedure uses to populate inbox uses the Session("UserID") to
> pull the user's messages. Somehow UserA is bringing back UserB's
> messages.
> This problem isn't limited to the inbox aspx page, but to any page that
> uses Session variables.
> Any help would be much appreciated. If you need more info, please let
> me know.
> Best Regards,
> Gene
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
No web farms or anythign like that. We have a single box that has 4
CPUs.

Best Regards,
Gene

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Futhermore, I was talking to our Sys Admin and he said the problem could
be caused because the client may be running a proxy server. This sounds
like a viable reason, but we are using cookieless sessions so the URL is
always unique.

Best Regards,
Gene

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Session Variable References Incorrect

I have a fairly large application with about 200 users that uses Session
variables. It would seem that occasionally these variables are being
referenced incorrectly to the extent that different users are updating
information and it is being saved to the wrong user. Is there any problem
with Session Variables that would cause this?not with session. more likley a coding bug where you store session values in
a shared (static) member, or vb module (whose members are all shared).

-- bruce (sqlwork.com)

"GHawley" <GHawley@.discussions.microsoft.com> wrote in message
news:F4501EA5-07FB-49CB-8E38-C5078D66BC9F@.microsoft.com...
>I have a fairly large application with about 200 users that uses Session
> variables. It would seem that occasionally these variables are being
> referenced incorrectly to the extent that different users are updating
> information and it is being saved to the wrong user. Is there any problem
> with Session Variables that would cause this?
The application simply references the Session["variable"] where ever it wants
to use it. The variable isn't stored, just referenced.

Thanks for the speedy response though.

"bruce barker (sqlwork.com)" wrote:

> not with session. more likley a coding bug where you store session values in
> a shared (static) member, or vb module (whose members are all shared).
> -- bruce (sqlwork.com)
> "GHawley" <GHawley@.discussions.microsoft.com> wrote in message
> news:F4501EA5-07FB-49CB-8E38-C5078D66BC9F@.microsoft.com...
> >I have a fairly large application with about 200 users that uses Session
> > variables. It would seem that occasionally these variables are being
> > referenced incorrectly to the extent that different users are updating
> > information and it is being saved to the wrong user. Is there any problem
> > with Session Variables that would cause this?
>
I would like to retract my previous statement and thank Bruce Barker for the
insight. I believe this is exactly the problem.

1 thousand times, thank you!!!!

"GHawley" wrote:

> The application simply references the Session["variable"] where ever it wants
> to use it. The variable isn't stored, just referenced.
> Thanks for the speedy response though.
> "bruce barker (sqlwork.com)" wrote:
> > not with session. more likley a coding bug where you store session values in
> > a shared (static) member, or vb module (whose members are all shared).
> > -- bruce (sqlwork.com)
> > "GHawley" <GHawley@.discussions.microsoft.com> wrote in message
> > news:F4501EA5-07FB-49CB-8E38-C5078D66BC9F@.microsoft.com...
> > >I have a fairly large application with about 200 users that uses Session
> > > variables. It would seem that occasionally these variables are being
> > > referenced incorrectly to the extent that different users are updating
> > > information and it is being saved to the wrong user. Is there any problem
> > > with Session Variables that would cause this?

Session Variable References Incorrect

I have a fairly large application with about 200 users that uses Session
variables. It would seem that occasionally these variables are being
referenced incorrectly to the extent that different users are updating
information and it is being saved to the wrong user. Is there any problem
with Session Variables that would cause this?not with session. more likley a coding bug where you store session values in
a shared (static) member, or vb module (whose members are all shared).
-- bruce (sqlwork.com)
"GHawley" <GHawley@.discussions.microsoft.com> wrote in message
news:F4501EA5-07FB-49CB-8E38-C5078D66BC9F@.microsoft.com...
>I have a fairly large application with about 200 users that uses Session
> variables. It would seem that occasionally these variables are being
> referenced incorrectly to the extent that different users are updating
> information and it is being saved to the wrong user. Is there any problem
> with Session Variables that would cause this?
The application simply references the Session["variable"] where ever it want
s
to use it. The variable isn't stored, just referenced.
Thanks for the speedy response though.
"bruce barker (sqlwork.com)" wrote:

> not with session. more likley a coding bug where you store session values
in
> a shared (static) member, or vb module (whose members are all shared).
> -- bruce (sqlwork.com)
> "GHawley" <GHawley@.discussions.microsoft.com> wrote in message
> news:F4501EA5-07FB-49CB-8E38-C5078D66BC9F@.microsoft.com...
>
>
I would like to retract my previous statement and thank Bruce Barker for the
insight. I believe this is exactly the problem.
1 thousand times, thank you!!!!
"GHawley" wrote:
> The application simply references the Session["variable"] where ever it wa
nts
> to use it. The variable isn't stored, just referenced.
> Thanks for the speedy response though.
> "bruce barker (sqlwork.com)" wrote:
>

Session variable question

Hi

If I use session variables does this depends on cookies being sent to the
client browser? If yes then what happens if the user disable cookies?

ThanksYes, then it wont work
but you can work cookieless sending the session id in the url

"RA" <ron_a1@.hotmail.com> wrote in message
news:uHIYDF7%23DHA.3272@.TK2MSFTNGP09.phx.gbl...
> Hi
> If I use session variables does this depends on cookies being sent to the
> client browser? If yes then what happens if the user disable cookies?
>
> Thanks
"EricJ" <ericReMoVe@.ThiSbitconsult.be.RE> wrote in message
news:403cbba2$0$785$ba620e4c@.news.skynet.be...
> Yes, then it wont work
> but you can work cookieless sending the session id in the url

How would you do this? I am using asp.net with c#

Thanks
> "RA" <ron_a1@.hotmail.com> wrote in message
> news:uHIYDF7%23DHA.3272@.TK2MSFTNGP09.phx.gbl...
> > Hi
> > If I use session variables does this depends on cookies being sent to
the
> > client browser? If yes then what happens if the user disable cookies?
> > Thanks
http://msdn.microsoft.com/library/d...asp12282000.asp
Session configuration
Below is a sample config.web file used to configure the session state
settings for an ASP.NET application:

<configuration>
<sessionstate
mode="inproc"
cookieless="false"
timeout="20"
sqlconnectionstring="data source=127.0.0.1;user id=sa;password="
server="127.0.0.1"
port="42424"
/>
</configuration>
The settings above are used to configure ASP.NET session state. Let's look
at each in more detail and cover the various uses afterward.

a.. Mode. The mode setting supports three options: inproc, sqlserver, and
stateserver. As stated earlier, ASP.NET supports two modes: in process and
out of process. There are also two options for out-of-process state
management: memory based (stateserver), and SQL Server based (sqlserver).
We'll discuss implementing these options shortly.
b.. Cookieless. The cookieless option for ASP.NET is configured with this
simple Boolean setting.
c.. Timeout. This option controls the length of time a session is
considered valid. The session timeout is a sliding value; on each request
the timeout period is set to the current time plus the timeout value
d.. Sqlconnectionstring. The sqlconnectionstring identifies the database
connection string that names the database used for mode sqlserver.
e.. Server. In the out-of-process mode stateserver, it names the server
that is running the required Windows NT service: ASPState.
f.. Port. The port setting, which accompanies the server setting,
identifies the port number that corresponds to the server setting for mode
stateserver.
"RA" <ron_a1@.hotmail.com> wrote in message
news:OUtUpn7%23DHA.2592@.TK2MSFTNGP10.phx.gbl...
> "EricJ" <ericReMoVe@.ThiSbitconsult.be.RE> wrote in message
> news:403cbba2$0$785$ba620e4c@.news.skynet.be...
> > Yes, then it wont work
> > but you can work cookieless sending the session id in the url
> How would you do this? I am using asp.net with c#
> Thanks
> > "RA" <ron_a1@.hotmail.com> wrote in message
> > news:uHIYDF7%23DHA.3272@.TK2MSFTNGP09.phx.gbl...
> > > Hi
> > > > If I use session variables does this depends on cookies being sent to
> the
> > > client browser? If yes then what happens if the user disable cookies?
> > > > > Thanks
> >
I have found a way to remove the session id in the url and still use
session variables throughout your web application.

In your web.config set the cookieless variable to false and create a
pages tag. See code below:

<pages buffer="true"
enableSessionState="true" /
<sessionState
... some other code
cookieless="false"
.... some other code
/
this will make your url look like this : www.mywebsite.com instead of
http://www.mywebsite.com/(etoczb55d...55)/mypage.aspx and still be
able to use session varialbles in your project.

Good luck!!!

"RA" <ron_a1@.hotmail.com> wrote in message news:<uHIYDF7#DHA.3272@.TK2MSFTNGP09.phx.gbl>...
> Hi
> If I use session variables does this depends on cookies being sent to the
> client browser? If yes then what happens if the user disable cookies?
>
> Thanks
Sidd,

The problem with this is that it wont work if the user has cookies disabled!

Try what you mentioned but disable all cookies on your browser... it wont
work!

In a scenario like that, you need to have the session stored in the URL
(cookiless=true)

-ZD

The user's sessionID is stored in a cookie on the browswer so the server
knows which
"Sidd" <pfsedney@.impactvet.com> wrote in message
news:bdc17678.0402260859.1befe734@.posting.google.c om...
> I have found a way to remove the session id in the url and still use
> session variables throughout your web application.
> In your web.config set the cookieless variable to false and create a
> pages tag. See code below:
> <pages buffer="true"
> enableSessionState="true" />
> <sessionState
> ... some other code
> cookieless="false"
> .... some other code
> />
> this will make your url look like this : www.mywebsite.com instead of
> http://www.mywebsite.com/(etoczb55d...55)/mypage.aspx and still be
> able to use session varialbles in your project.
>
> Good luck!!!
> "RA" <ron_a1@.hotmail.com> wrote in message
news:<uHIYDF7#DHA.3272@.TK2MSFTNGP09.phx.gbl>...
> > Hi
> > If I use session variables does this depends on cookies being sent to
the
> > client browser? If yes then what happens if the user disable cookies?
> > Thanks

Session variable returns after deletion

I've heard of session variables being lost, but I've got one that keeps comi
ng back after I've deleted it. I'm using a session variable as a flag betwe
en a popup window and its parent window. The session variable is created in
the popup window with a va
lue of 100. The popup window is then closed. When this happens, a postback
occurs in the parent window. In the Page Load function of the parent windo
w, there is a check to see if the session variable is equal to 100. If it i
s, I save some data and set
the session variable to 0. Then I delete the session variable using Session
.Remove. I followed the values of the session variable in my debugger and it
comes back as 0 and then Nothing as expected.
The problem happens when I've finished with that and I click on another butt
on. The Page Load function runs again and when it gets to the check for the
session variable, it's still there, and it still equals 100, even though it
was set to zero and then d
eleted.
Is this behavior caused by my trying to modify a session variable that was c
reated in a different window? Or is it something else?What code did you use to call your second window?
"LKB" <anonymous@.discussions.microsoft.com> wrote in message
news:52266907-DC7B-406B-8E73-FEAF49651B1B@.microsoft.com...
> I've heard of session variables being lost, but I've got one that keeps
coming back after I've deleted it. I'm using a session variable as a flag
between a popup window and its parent window. The session variable is
created in the popup window with a value of 100. The popup window is then
closed. When this happens, a postback occurs in the parent window. In the
Page Load function of the parent window, there is a check to see if the
session variable is equal to 100. If it is, I save some data and set the
session variable to 0. Then I delete the session variable using
Session.Remove. I followed the values of the session variable in my debugger
and it comes back as 0 and then Nothing as expected.
> The problem happens when I've finished with that and I click on another
button. The Page Load function runs again and when it gets to the check for
the session variable, it's still there, and it still equals 100, even though
it was set to zero and then deleted.
> Is this behavior caused by my trying to modify a session variable that was
created in a different window? Or is it something else?
>
The code for the second window was javascript. I'd love a way to do it strai
ght from the CodeBehind VB, but I haven't found a way to make that work yet.
Here's the Javascript function I used:
function PopUp(winWidth, winHeight, sURL)
{
var winLeft = (screen.width-winWidth)/2;
var winTop = (screen.height-winHeight)/2;
var sName = "_blank";
var sFeatures = "menubar=0, toolbar=0, titlebar=1, resizable=0, scrollbars=0
";
var sSizes = " width=" + winWidth + ",height=" + winHeight + ",top=" + winTo
p + ",left=" + winLeft;
sFeatures = sFeatures + sSizes;
win1 = window.open(sURL, sName, sFeatures);
}
In the VB, I put this line in the Page Load:
Button1.Attributes.Add("OnClick", "PopUp(375, 200, 'PopUp.aspx')")
-- YouKnowIt wrote: --
What code did you use to call your second window?

Session Variable Set to Nothing on Postback?

Why do my session variables get blown away on a post back?The user might have their cookies setting turned off.

Now, you mentioned "post-back". Are you saying that it only happens during
a post-back, or does it happen whenever a page is retrieved from the server?

"Thanks" <thanks@.thanks.com> wrote in message
news:u0%23xmho7DHA.2392@.TK2MSFTNGP11.phx.gbl...
> Why do my session variables get blown away on a post back?
Postback.. It appears to be my firewall. After you mentioned the Cookies
thing, I shut down my firewall and retried it, seems to be working.

"Peter Rilling" <peter@.nospam.rilling.net> wrote in message
news:e8vmXoo7DHA.2064@.TK2MSFTNGP11.phx.gbl...
> The user might have their cookies setting turned off.
> Now, you mentioned "post-back". Are you saying that it only happens
during
> a post-back, or does it happen whenever a page is retrieved from the
server?
> "Thanks" <thanks@.thanks.com> wrote in message
> news:u0%23xmho7DHA.2392@.TK2MSFTNGP11.phx.gbl...
> > Why do my session variables get blown away on a post back?

Session variable trouble

Hi,
I am facing a trouble. I have some Session variables in my code and
somehow my session variables are getting mixed up with other users.
For example User A has access to 10 companies and User B has access to
5, now when both of us hits to the server at the same time then their
session variables gets mixedup means either User A and USer B will have
now 5 companies or both have 10 companies. Now again when User A hits
to the server he will have again his session variables setting.
I have initialsed my session variables in session_Onstart event.
Now and clue why it is happening.
Regards,
Amit AroraHi, how are you simulating the two different users? Same/differenr machine?
Same/different browser?
diffrent machine and diffrent browser...
diffrent machine and same browser...
> Hi,
> I am facing a trouble. I have some Session variables in my code and
> somehow my session variables are getting mixed up with other users.
> For example User A has access to 10 companies and User B has access to
> 5, now when both of us hits to the server at the same time then their
> session variables gets mixedup means either User A and USer B will have
> now 5 companies or both have 10 companies. Now again when User A hits
> to the server he will have again his session variables setting.
> I have initialsed my session variables in session_Onstart event.
> Now and clue why it is happening.
> Regards,
> Amit Arora
By any chance using *static* members in those objects that you put in
session?
Hans Kesting
Nopes, infact earlier I was using static variables but later on I
changed it to Sessions.......
Have you checked that you don't store a static variable in your session
objet ? What matters is not really that you use session variables, but
rather what exactly you store in those session variables.
It should be fairly easy to repro the problem or not with just a small piece
of code so that you can make sure it works in the trivial case. From there
you'll make sure if this is a problem in your code (I would expect this) or
if you have really a big problem with sessions.
--
Patrice
<aroraamit81@.gmail.com> a crit dans le message de news:
1144930643.742818.170670@.g10g2000cwb.googlegroups.com...
> Nopes, infact earlier I was using static variables but later on I
> changed it to Sessions.......
>
Patric Here goes my long code, if you could check it out, then I would
be more than obliged to you...............
namespace CMS
{
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Configuration;
using Properties;
//using UserContorls;
/// <summary>
/// Summary description for DisplayCompanyContacts.
/// </summary>
public class DisplayCompanyContacts : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.PlaceHolder plcompany;
LiteralControl litcontrol;
protected System.Web.UI.WebControls.CheckBox CheckBox1;
LiteralControl litcontrol2;
string roleid,userid;
protected System.Web.UI.WebControls.Button btn;
protected System.Web.UI.WebControls.LinkButton ClearLink;
protected System.Web.UI.HtmlControls.HtmlInputHidden CheckBoxFlag;
protected System.Web.UI.HtmlControls.HtmlInputHidden CompanyID;
protected System.Web.UI.WebControls.LinkButton SelectLink;
private void Page_Load(object sender, System.EventArgs e)
{
//DisplayConversationFromCalander();
if (Session["Userid"].ToString()=="")
{
Session.Abandon();
Response.Redirect("Login.aspx");
}
Session["ContactCheckBoxIDsInLeftMenu"]="";
Session["CompaniesCheckBoxIDsInLeftMenu"]="";
//CommonProperties.ContactCheckBoxIDsInLeftMenu="";
//CommonProperties.CompaniesCheckBoxIDsInLeftMenu="";
roleid=Session["Roleid"].ToString().Trim();
userid=Session["Userid"].ToString().Trim();
//if(!IsPostBack)
bindleftpanel();
///Removing these Common Properties and Placing Sessions Instead
if(Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Length>0)
Session["CompaniesCheckBoxIDsInLeftMenu"]=
Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Substring
(0,Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Length-1);
if(Session["ContactCheckBoxIDsInLeftMenu"].ToString().Length>0)
Session["ContactCheckBoxIDsInLeftMenu"]=
Session["ContactCheckBoxIDsInLeftMenu"].ToString().Substring
(0,Session["ContactCheckBoxIDsInLeftMenu"].ToString().Length-1);
/* if(CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Length>0)
CommonProperties.CompaniesCheckBoxIDsInLeftMenu=
CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Substring
(0,CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Length-1);
if(CommonProperties.ContactCheckBoxIDsInLeftMenu.Length>0)
CommonProperties.ContactCheckBoxIDsInLeftMenu=
CommonProperties.ContactCheckBoxIDsInLeftMenu.Substring
(0,CommonProperties.ContactCheckBoxIDsInLeftMenu.Length-1); */
/* if (Request.Url!=null)
{
string _pageurl=Request.Url.ToString();
char[] splitter = {'/'};
string[] arInfo = _pageurl.Split(splitter);
for(int x = 0; x < arInfo.Length; x++)
{
_pageurl=arInfo[x];
}
if (_pageurl=="ViewContact.aspx")
{
UserContorls.ViewContact viewcontact=new
CMS.UserContorls.ViewContact();
viewcontact.BindViewDetails();
}
} */
}
public void bindleftpanel()
{
using( SqlConnection strcon=new SqlConnection
(ConfigurationSettings.AppSettings["CMSConnection"]))
{
SqlCommand objcomm;
SqlDataReader objread;
strcon.Open();
//string sql;
/*if (roleid=="1" || roleid=="2")
{
if (CommonProperties.FilterCompanyId==null)
{
sql="select * from company where COMPANY_ID in (Select COMPANY_ID
from COMPANYALLOCATION where COMPANYALLOCATEDTO='"+userid+"' and
USERROLEID="+roleid+" Union Select Company_id from Company where
COMPANY_ADDEDBY='"+userid+"') order by company_name";
}
else
{
sql="select * from company where COMPANY_ID in (Select COMPANY_ID
from COMPANYALLOCATION where COMPANYALLOCATEDTO='"+userid+"' and
USERROLEID="+Session["Roleid"]+" Union Select Company_id from Company
where COMPANY_ADDEDBY='"+userid+"') and
company_id='"+CommonProperties.FilterCompanyId.ToString()+"' order by
company_name";
}
}
else
{
sql="select * from company order by company_name";
}*/
//objcomm=new SqlCommand(sql,strcon);
//kapil kalra 20-mar-2006 permission check
int permission=0;
if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session["Role
ID"]),"Allow
all Companies")))
{
permission=1;//full pemission
}
objcomm=new SqlCommand("Usp_LeftMenu_Company",strcon);
objcomm.CommandType = CommandType.StoredProcedure;
objcomm.Parameters.Clear();
objcomm.Parameters.Add( "@.SESSION_ROLEID", roleid );
objcomm.Parameters.Add( "@.SESSION_USERID", userid );
objcomm.Parameters.Add( "@.permission", permission );
/* objcomm.Parameters.Add(
"@.FILTER_ROLEID",CommonProperties.Filterroleid);
objcomm.Parameters.Add(
"@.FILTER_USERID",CommonProperties.Filteruserid);
objcomm.Parameters.Add(
"@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
objcomm.Parameters.Add(
"@.FILTER_INVERTICALID",CommonProperties.FilterIV);
objcomm.Parameters.Add(
"@.FILTER_DOMAINID",CommonProperties.FilterDomain);
objcomm.Parameters.Add(
"@.FILTER_SOURCEID",CommonProperties.FilterSource);
objcomm.Parameters.Add(
"@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
objcomm.Parameters.Add(
"@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
objcomm.Parameters.Add(
"@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
objcomm.Parameters.Add(
"@.FILTER_EMAILID",CommonProperties.Filteremail);
objcomm.Parameters.Add(
"@.FILTER_PHONENO",CommonProperties.Filterphone);*/
try
{
objcomm.Parameters.Add(
"@.FILTER_ROLEID",Convert.ToInt32(Session["Filterroleid"]));
objcomm.Parameters.Add(
"@.FILTER_USERID",Convert.ToInt32(Session["Filteruserid"]));
objcomm.Parameters.Add(
"@.FILTER_COMPANYID",Session["FilterCompanyId"].ToString());
objcomm.Parameters.Add(
"@.FILTER_INVERTICALID",Convert.ToInt32(Session["FilterIV"]));
objcomm.Parameters.Add(
"@.FILTER_DOMAINID",Convert.ToInt32(Session["FilterDomain"]));
objcomm.Parameters.Add(
"@.FILTER_SOURCEID",Convert.ToInt32(Session["FilterSource"]));
objcomm.Parameters.Add(
"@.FILTER_WORKTYPEID",Convert.ToInt32(Session["FilterWorkType"]));
objcomm.Parameters.Add(
"@.FILTER_DISPOSITIONID",Convert.ToInt32(Session["FilterDisposition"]));
objcomm.Parameters.Add(
"@.FILTER_DESIGNATION",Session["FilterDesignation"].ToString());
objcomm.Parameters.Add(
"@.FILTER_EMAILID",Session["Filteremail"].ToString());
objcomm.Parameters.Add(
"@.FILTER_PHONENO",Session["Filterphone"].ToString());
}
catch
{}
objread=objcomm.ExecuteReader();
//CommonProperties.CompaniesCheckBoxIDsInLeftMenu="";
//Session["CompaniesCheckBoxIDsInLeftMenu"]="";
if (objread.HasRows)
{
while (objread.Read())
{
CheckBox chkbox=new CheckBox();
chkbox.ID="chkcompany"+objread["company_id"].ToString();
//Response.Write(objread["company_id"]);
chkbox.AutoPostBack=true;
chkbox.EnableViewState=true;
chkbox.Attributes.Add("onClick","java script:Foo(this);");
chkbox.EnableViewState=true;
//CommonProperties.CompaniesCheckBoxIDsInLeftMenu+=chkbox.ID+",";
Session["CompaniesCheckBoxIDsInLeftMenu"]+=chkbox.ID+",";
//if (CommonProperties.SelectedCompany!=null)
if (Session["SelectedCompany"].ToString()!="" )
{
//string info_company =
CommonProperties.SelectedCompany;
string info_company =
Session["SelectedCompany"].ToString();
char[] splitter = {','};
string[] arInfo = info_company.Split(splitter);
for(int x = 0; x < arInfo.Length; x++)
{
if (chkbox.ID==arInfo[x])
{
chkbox.Checked=true;
}
}
}
chkbox.CheckedChanged+=new
System.EventHandler(this.ASSIGN_CHECKED);
plcompany.Controls.Add(chkbox);
litcontrol=new LiteralControl();
litcontrol.Text="<span
class=FilterListCompany>"+objread["company_name"].ToString()+"</span><br>";
plcompany.Controls.Add(litcontrol );
subcontact(objread["company_id"].ToString());
}
}
objcomm.Cancel();
objread.Close();
}
}
public void subcontact(string company_id)
{
using(SqlConnection strcon2=new SqlConnection
(ConfigurationSettings.AppSettings["CMSConnection"]))
{
SqlCommand objcomm2;
SqlDataReader objread2;
strcon2.Open();
//string sql2;
int permission=0;
if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session["Role
ID"]),"Allow
all Companies")))
{
permission=1;//full pemission
}
objcomm2=new SqlCommand("Usp_LeftMenu_Contact",strcon2);
objcomm2.CommandType = CommandType.StoredProcedure;
objcomm2.Parameters.Clear();
objcomm2.Parameters.Add( "@.SESSION_ROLEID", roleid );
objcomm2.Parameters.Add( "@.SESSION_USERID", userid );
objcomm2.Parameters.Add( "@.permission", permission );
/* objcomm2.Parameters.Add(
"@.FILTER_ROLEID",CommonProperties.Filterroleid);
objcomm2.Parameters.Add(
"@.FILTER_USERID",CommonProperties.Filteruserid);
objcomm2.Parameters.Add(
"@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
objcomm2.Parameters.Add(
"@.FILTER_INVERTICALID",CommonProperties.FilterIV);
objcomm2.Parameters.Add(
"@.FILTER_DOMAINID",CommonProperties.FilterDomain);
objcomm2.Parameters.Add(
"@.FILTER_SOURCEID",CommonProperties.FilterSource);
objcomm2.Parameters.Add(
"@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
objcomm2.Parameters.Add(
"@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
objcomm2.Parameters.Add(
"@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
objcomm2.Parameters.Add(
"@.FILTER_EMAILID",CommonProperties.Filteremail);
objcomm2.Parameters.Add(
"@.FILTER_PHONENO",CommonProperties.Filterphone);
objcomm2.Parameters.Add( "@.FILTER_CONTACTCOMPANYID",company_id);*/
objcomm2.Parameters.Add( "@.FILTER_ROLEID",Session["Filterroleid"]);
objcomm2.Parameters.Add( "@.FILTER_USERID",Session["Filteruserid"]);
objcomm2.Parameters.Add(
"@.FILTER_COMPANYID",Session["FilterCompanyId"]);
objcomm2.Parameters.Add(
"@.FILTER_INVERTICALID",Session["FilterIV"]);
objcomm2.Parameters.Add(
"@.FILTER_DOMAINID",Session["FilterDomain"]);
objcomm2.Parameters.Add(
"@.FILTER_SOURCEID",Session["FilterSource"]);
objcomm2.Parameters.Add(
"@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
objcomm2.Parameters.Add(
"@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
objcomm2.Parameters.Add(
"@.FILTER_DESIGNATION",Session["FilterDesignation"]);
objcomm2.Parameters.Add( "@.FILTER_EMAILID",Session["Filteremail"]);
objcomm2.Parameters.Add( "@.FILTER_PHONENO",Session["Filterphone"]);
objcomm2.Parameters.Add( "@.FILTER_CONTACTCOMPANYID",company_id);
objread2=objcomm2.ExecuteReader();
//CommonProperties.ContactCheckBoxIDsInLeftMenu="";
//Session["ContactCheckBoxIDsInLeftMenu"]="";
if (objread2.HasRows)
{
while(objread2.Read())
{
litcontrol2=new LiteralControl();
litcontrol2.Text=" ";
plcompany.Controls.Add(litcontrol2 );
CheckBox chkbox=new CheckBox();
chkbox.ID="chkcontact"+objread2["contact_id"].ToString();
//CommonProperties.ContactCheckBoxIDsInLeftMenu+=chkbox.ID+",";
Session["ContactCheckBoxIDsInLeftMenu"]+=chkbox.ID+",";
chkbox.AutoPostBack=true;
chkbox.EnableViewState=true;
//if (CommonProperties.SelectedContact!=null)
if (Session["SelectedContact"].ToString()!="")
{
//string info_company =
CommonProperties.SelectedContact;
string info_company =
Session["SelectedContact"].ToString();
char[] splitter = {','};
string[] arInfo = info_company.Split(splitter);
for(int x = 0; x < arInfo.Length; x++)
{
if (chkbox.ID==arInfo[x])
{
chkbox.Checked=true;
}
}
}
chkbox.CheckedChanged+=new
System.EventHandler(this.Contact_Checked);
plcompany.Controls.Add(chkbox);
litcontrol2=new LiteralControl();
if(roleid=="4" ||roleid=="5"||roleid=="6"||roleid=="7" )
{
int flag=ColorSeg(company_id,objread2["contact_id"].ToString());
if(flag==0)//not alloted
{
litcontrol2.Text="<span
class=FilterListContact>"+objread2["contact_name"].ToString()+"</span><br>";
}
else if(flag==1)//alloted to RA
{
litcontrol2.Text="<span
class=FilterListContactRA>"+objread2["contact_name"].ToString()+"</span><br>
";
}
else if(flag==2)// alloted to SR
{
litcontrol2.Text="<span
class=FilterListContactSR>"+objread2["contact_name"].ToString()+"</span><br>
";
}
else// alloted to both
{
litcontrol2.Text="<span
class=FilterListContactBoth>"+objread2["contact_name"].ToString()+"</span><b
r>";
}
}
else
{
litcontrol2.Text="<span
class=FilterListContact>"+objread2["contact_name"].ToString()+"</span><br>";
}
plcompany.Controls.Add(litcontrol2 );
}
}
objcomm2.Cancel();
objread2.Close();
strcon2.Close();
}
}
private int ColorSeg(string company_id,string contactid)
{
int flag=0;
string kk;
string sql="SELECT userroleid FROM
dbo.CONTACTSALLOCATION where CONTACT_ID="+contactid+" and userroleid
in(1,2)";
SqlConnection conn=new SqlConnection
(ConfigurationSettings.AppSettings["CMSConnection"]);
SqlCommand cmd=new SqlCommand();
cmd.Parameters.Clear();
cmd.CommandText="dbo.[Usp_LeftPanelColor]";
cmd.CommandType=CommandType.StoredProcedure;
cmd.Connection=conn;
cmd.Parameters.Add("@.contactid",Convert.ToInt32(contactid));
DataSet ds=new DataSet();
SqlDataAdapter adpter=new SqlDataAdapter(cmd);
adpter.Fill(ds);
if(ds.Tables[0].Rows.Count>0)
{
kk= ds.Tables[0].Rows[0]["userroleid"].ToString();
flag=Convert.ToInt32(kk);
if(ds.Tables[0].Rows.Count>1)
{
flag=3;
}
}
return flag;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SelectLink.Click += new
System.EventHandler(this.SelectLink_Click);
this.ClearLink.Click += new
System.EventHandler(this.ClearLink_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
public void ASSIGN_CHECKED(object sender, System.EventArgs e)
{
//CommonProperties.SelectedCompany=null;
Session["SelectedCompany"]="";
using( SqlConnection strcon=new SqlConnection
(ConfigurationSettings.AppSettings["CMSConnection"]))
{
SqlCommand objcomm;
SqlDataReader objread;
strcon.Open();
/*string sql;
if (roleid=="1" || roleid=="2")
{
sql="select * from company where COMPANY_ID in (Select COMPANY_ID
from COMPANYALLOCATION where COMPANYALLOCATEDTO='"+userid+"' and
USERROLEID="+Session["Roleid"]+" Union Select Company_id from Company
where COMPANY_ADDEDBY='"+userid+"') order by company_name";
}
else
{
sql="select * from company order by company_name";
}
objcomm=new SqlCommand(sql,strcon);*/
int permission=0;
if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session["Role
ID"]),"Allow
all Companies")))
{
permission=1;//full pemission
}
objcomm=new SqlCommand("Usp_LeftMenu_Company",strcon);
objcomm.CommandType = CommandType.StoredProcedure;
objcomm.Parameters.Clear();
objcomm.Parameters.Add( "@.SESSION_ROLEID", roleid );
objcomm.Parameters.Add( "@.SESSION_USERID", userid );
objcomm.Parameters.Add( "@.permission", permission );
/*objcomm.Parameters.Add(
"@.FILTER_ROLEID",CommonProperties.Filterroleid);
objcomm.Parameters.Add(
"@.FILTER_USERID",CommonProperties.Filteruserid);
objcomm.Parameters.Add(
"@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
objcomm.Parameters.Add(
"@.FILTER_INVERTICALID",CommonProperties.FilterIV);
objcomm.Parameters.Add(
"@.FILTER_DOMAINID",CommonProperties.FilterDomain);
objcomm.Parameters.Add(
"@.FILTER_SOURCEID",CommonProperties.FilterSource);
objcomm.Parameters.Add(
"@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
objcomm.Parameters.Add(
"@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
objcomm.Parameters.Add(
"@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
objcomm.Parameters.Add(
"@.FILTER_EMAILID",CommonProperties.Filteremail);
objcomm.Parameters.Add(
"@.FILTER_PHONENO",CommonProperties.Filterphone);*/
objcomm.Parameters.Add( "@.FILTER_ROLEID",Session["Filterroleid"]);
objcomm.Parameters.Add( "@.FILTER_USERID",Session["Filteruserid"]);
objcomm.Parameters.Add(
"@.FILTER_COMPANYID",Session["FilterCompanyId"]);
objcomm.Parameters.Add(
"@.FILTER_INVERTICALID",Session["FilterIV"]);
objcomm.Parameters.Add(
"@.FILTER_DOMAINID",Session["FilterDomain"]);
objcomm.Parameters.Add(
"@.FILTER_SOURCEID",Session["FilterSource"]);
objcomm.Parameters.Add(
"@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
objcomm.Parameters.Add(
"@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
objcomm.Parameters.Add(
"@.FILTER_DESIGNATION",Session["FilterDesignation"]);
objcomm.Parameters.Add( "@.FILTER_EMAILID",Session["Filteremail"]);
objcomm.Parameters.Add( "@.FILTER_PHONENO",Session["Filterphone"]);
objread=objcomm.ExecuteReader();
if (objread.HasRows)
{
while (objread.Read())
{
CheckBox check =
(CheckBox)plcompany.FindControl("chkcompany"+objread["company_id"].ToString(
));
string _unchkdcompanyid=check.ID;
if (check.Checked==true)
{
string _chkdcompanyid=check.ID;
//if (CommonProperties.SelectedCompany!=null)
if (Session["SelectedCompany"].ToString().Trim()!="" )
{
//CommonProperties.SelectedCompany=CommonProperties.SelectedCompany+","+_chk
dcompanyid;
Session["SelectedCompany"]=Session["SelectedCompany"]+","+_chkdcompanyid;
ChkContact(_chkdcompanyid);
}
else
{
//CommonProperties.SelectedCompany=_chkdcompanyid;
Session["SelectedCompany"]=_chkdcompanyid;
ChkContact(_chkdcompanyid);
}
}
else
{
// UnChkContatct(_unchkdcompanyid);
}
}
}
if(Session["SelectedCompany"].ToString().StartsWith(","))
{
Session["SelectedCompany"]=Session["SelectedCompany"].ToString().Substring(1
,Session["SelectedCompany"].ToString().Length);
}
if(Session["SelectedCompany"].ToString().EndsWith(","))
{
Session["SelectedCompany"]=Session["SelectedCompany"].ToString().Substring(0
,Session["SelectedCompany"].ToString().Length-1);
}
if(Session["SelectedContact"].ToString().StartsWith(","))
{
Session["SelectedContact"]=Session["SelectedContact"].ToString().Substring(1
,Session["SelectedContact"].ToString().Length);
}
if(Session["SelectedContact"].ToString().EndsWith(","))
{
Session["SelectedContact"]=Session["SelectedContact"].ToString().Substring(0
,Session["SelectedContact"].ToString().Length-1);
}
objcomm.Cancel();
objread.Close();
}
string FlagStatus=CheckBoxFlag.Value.ToString();
string strCompanyID=CompanyID.Value.ToString();
strCompanyID=strCompanyID.Substring(strCompanyID.LastIndexOf("_")+1);
if(!Convert.ToBoolean(FlagStatus))
UnChkContatct(strCompanyID);
}
public void ChkContact(string chkedCmpy)
{
chkedCmpy=chkedCmpy.Replace("chkcompany","");
SqlConnection conn=new
SqlConnection(ConfigurationSettings.AppSettings["CMSConnection"]);
conn.Open();
// SqlCommand cmdcontact=new SqlCommand("Select CONTACT_ID from
Contacts where CONTACT_COMPANY_ID='"+chkedCmpy+"'", conn);
int permission=0;
if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session["Role
ID"]),"Allow
all Companies")))
{
permission=1;//full pemission
}
SqlCommand cmdcontact=new SqlCommand("AutoChkContacts",conn);
cmdcontact.CommandType = CommandType.StoredProcedure;
cmdcontact.Parameters.Add( "@.SESSION_ROLEID", roleid );
cmdcontact.Parameters.Add( "@.SESSION_USERID", userid );
cmdcontact.Parameters.Add( "@.permission", permission );
/*cmdcontact.Parameters.Add(
"@.FILTER_ROLEID",CommonProperties.Filterroleid);
cmdcontact.Parameters.Add(
"@.FILTER_USERID",CommonProperties.Filteruserid);
cmdcontact.Parameters.Add(
"@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
cmdcontact.Parameters.Add(
"@.FILTER_INVERTICALID",CommonProperties.FilterIV);
cmdcontact.Parameters.Add(
"@.FILTER_DOMAINID",CommonProperties.FilterDomain);
cmdcontact.Parameters.Add(
"@.FILTER_SOURCEID",CommonProperties.FilterSource);
cmdcontact.Parameters.Add(
"@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
cmdcontact.Parameters.Add(
"@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
cmdcontact.Parameters.Add(
"@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
cmdcontact.Parameters.Add(
"@.FILTER_EMAILID",CommonProperties.Filteremail);
cmdcontact.Parameters.Add(
"@.FILTER_PHONENO",CommonProperties.Filterphone);*/
cmdcontact.Parameters.Add(
"@.FILTER_ROLEID",Session["Filterroleid"]);
cmdcontact.Parameters.Add(
"@.FILTER_USERID",Session["Filteruserid"]);
cmdcontact.Parameters.Add(
"@.FILTER_COMPANYID",Session["FilterCompanyId"]);
cmdcontact.Parameters.Add(
"@.FILTER_INVERTICALID",Session["FilterIV"]);
cmdcontact.Parameters.Add(
"@.FILTER_DOMAINID",Session["FilterDomain"]);
cmdcontact.Parameters.Add(
"@.FILTER_SOURCEID",Session["FilterSource"]);
cmdcontact.Parameters.Add(
"@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
cmdcontact.Parameters.Add(
"@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
cmdcontact.Parameters.Add(
"@.FILTER_DESIGNATION",Session["FilterDesignation"]);
cmdcontact.Parameters.Add(
"@.FILTER_EMAILID",Session["Filteremail"]);
cmdcontact.Parameters.Add(
"@.FILTER_PHONENO",Session["Filterphone"]);
cmdcontact.Parameters.Add( "@.FILTER_CONTACTCOMPANYID", chkedCmpy );
SqlDataReader rdr=cmdcontact.ExecuteReader();
if(rdr.HasRows)
{
while(rdr.Read())
{
CheckBox check =
(CheckBox)plcompany.FindControl("chkcontact"+rdr["CONTACT_ID"].ToString());
check.Checked=true;
string _chkdcontactid=check.ID;
//if (CommonProperties.SelectedContact!=null)
if (Session["SelectedContact"].ToString()!="")
{
int flag=AldyInsertCont(_chkdcontactid);
if(flag==0)
//CommonProperties.SelectedContact=CommonProperties.SelectedContact+","+_chk
dcontactid;
Session["SelectedContact"]=Session["SelectedContact"]+","+_chkdcontactid;
}
else
{
//CommonProperties.SelectedContact=_chkdcontactid;
Session["SelectedContact"]=_chkdcontactid;
}
}
}
}
private int AldyInsertCont(string contid)
{
int flag=0;
string[] Cont=Session["SelectedContact"].ToString().Split(new char[]
{','});
for(int i=0;i<Cont.Length;i++)
{
if(contid==Cont[i].ToString())
{
flag=1;
break;
}
}
return flag;
}
public void UnChkContatct(string chkedCmpy)
{
string chkedCmpy1=chkedCmpy;
chkedCmpy=chkedCmpy.Replace("chkcompany","");
SqlConnection conn=new
SqlConnection(ConfigurationSettings.AppSettings["CMSConnection"]);
conn.Open();
int permission=0;
if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session["Role
ID"]),"Allow
all Companies")))
{
permission=1;//full pemission
}
SqlCommand cmdcontact=new SqlCommand("AutoChkContacts",conn);
cmdcontact.CommandType = CommandType.StoredProcedure;
cmdcontact.Parameters.Clear();
cmdcontact.Parameters.Add( "@.SESSION_ROLEID", roleid );
cmdcontact.Parameters.Add( "@.SESSION_USERID", userid );
cmdcontact.Parameters.Add( "@.permission", permission );
/*cmdcontact.Parameters.Add(
"@.FILTER_ROLEID",CommonProperties.Filterroleid);
cmdcontact.Parameters.Add(
"@.FILTER_USERID",CommonProperties.Filteruserid);
cmdcontact.Parameters.Add(
"@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
cmdcontact.Parameters.Add(
"@.FILTER_INVERTICALID",CommonProperties.FilterIV);
cmdcontact.Parameters.Add(
"@.FILTER_DOMAINID",CommonProperties.FilterDomain);
cmdcontact.Parameters.Add(
"@.FILTER_SOURCEID",CommonProperties.FilterSource);
cmdcontact.Parameters.Add(
"@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
cmdcontact.Parameters.Add(
"@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
cmdcontact.Parameters.Add(
"@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
cmdcontact.Parameters.Add(
"@.FILTER_EMAILID",CommonProperties.Filteremail);
cmdcontact.Parameters.Add(
"@.FILTER_PHONENO",CommonProperties.Filterphone);*/
cmdcontact.Parameters.Add(
"@.FILTER_ROLEID",Session["Filterroleid"]);
cmdcontact.Parameters.Add(
"@.FILTER_USERID",Session["Filteruserid"]);
cmdcontact.Parameters.Add(
"@.FILTER_COMPANYID",Session["FilterCompanyId"]);
cmdcontact.Parameters.Add(
"@.FILTER_INVERTICALID",Session["FilterIV"]);
cmdcontact.Parameters.Add(
"@.FILTER_DOMAINID",Session["FilterDomain"]);
cmdcontact.Parameters.Add(
"@.FILTER_SOURCEID",Session["FilterSource"]);
cmdcontact.Parameters.Add(
"@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
cmdcontact.Parameters.Add(
"@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
cmdcontact.Parameters.Add(
"@.FILTER_DESIGNATION",Session["FilterDesignation"]);
cmdcontact.Parameters.Add(
"@.FILTER_EMAILID",Session["Filteremail"]);
cmdcontact.Parameters.Add(
"@.FILTER_PHONENO",Session["Filterphone"]);
cmdcontact.Parameters.Add( "@.FILTER_CONTACTCOMPANYID", chkedCmpy );
SqlDataReader rdr=cmdcontact.ExecuteReader();
// string[] ChkContacts=CommonProperties.SelectedContact.Split(new
char[] {','});
// CommonProperties.SelectedContact=null;
if(rdr.HasRows)
{
while(rdr.Read())
{
CheckBox check1 = (CheckBox)plcompany.FindControl(chkedCmpy1);
CheckBox check =
(CheckBox)plcompany.FindControl("chkcontact"+rdr["CONTACT_ID"].ToString());
//if(CommonProperties.SelectedContact!=null)
if(Session["SelectedContact"].ToString()!="")
{
/* if(CommonProperties.SelectedContact.IndexOf(check.ID.ToString()+",")>-1)
CommonProperties.SelectedContact=CommonProperties.SelectedContact.Replace(ch
eck.ID.ToString()+",","");
else
if(CommonProperties.SelectedContact.IndexOf(check.ID.ToString())>-1)
CommonProperties.SelectedContact=CommonProperties.SelectedContact.Replace(ch
eck.ID.ToString(),"");*/
if(Session["SelectedContact"].ToString().IndexOf(check.ID.ToString()+",")>-1
)
Session["SelectedContact"]=Session["SelectedContact"].ToString().Replace(che
ck.ID.ToString()+",","");
else
if(Session["SelectedContact"].ToString().IndexOf(check.ID.ToString())>-1)
Session["SelectedContact"]=Session["SelectedContact"].ToString().Replace(che
ck.ID.ToString(),"");
}
// CommonProperties.SelectedContact=null;
check.Checked=false;
}
}
}
public void Contact_Checked(object sender, System.EventArgs e)
{
// CommonProperties.SelectedContact=null;
Session["SelectedContact"]="";
using( SqlConnection strcon=new SqlConnection
(ConfigurationSettings.AppSettings["CMSConnection"]))
{
SqlCommand objcomm;
SqlDataReader objread;
strcon.Open();
/*string sql;
if ( roleid=="2")
{
sql="select * from contacts where CONTACT_ID IN (Select CONTACT_ID
from Contacts where CONTACT_UPDATE_BY_ID='"+userid+"' UNION Select
CONTACT_ID from CONTACTSALLOCATION where
CONTACTSALLOCATEDTO='"+userid+"' and USERROLEID="+Session["Roleid"]+")
order by contact_name";
}
else if(roleid=="1" )
{
sql="select * from contacts where CONTACT_ID IN (Select CONTACT_ID
from Contacts where CONTACT_UPDATE_BY_ID='"+userid+"' UNION Select
CONTACT_ID from CONTACTSALLOCATION where
CONTACTSALLOCATEDTO='"+userid+"' and USERROLEID="+Session["Roleid"]+"
Union Select CONTACT_ID from Contacts where contact_company_id in
(select COMPANY_ID from company where COMPANY_ID in (Select COMPANY_ID
from COMPANYALLOCATION where COMPANYALLOCATEDTO='"+userid+"' and
USERROLEID="+Session["Roleid"]+" Union Select Company_id from Company
where COMPANY_ADDEDBY='"+userid+"'))) order by contact_name";
}
else
{
sql="select * from contacts order by contact_name";
}
//Response.Write (sql);
//Response.End();
objcomm=new SqlCommand(sql,strcon);*/
int permission=0;
if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session["Role
ID"]),"Allow
all Companies")))
{
permission=1;//full pemission
}
objcomm=new SqlCommand("Usp_LeftMenu_Contact_Checked",strcon);
objcomm.CommandType = CommandType.StoredProcedure;
objcomm.Parameters.Add( "@.SESSION_ROLEID", roleid );
objcomm.Parameters.Add( "@.SESSION_USERID", userid );
objcomm.Parameters.Add( "@.permission", permission );
/* objcomm.Parameters.Add(
"@.FILTER_ROLEID",CommonProperties.Filterroleid);
objcomm.Parameters.Add(
"@.FILTER_USERID",CommonProperties.Filteruserid);
objcomm.Parameters.Add(
"@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
objcomm.Parameters.Add(
"@.FILTER_INVERTICALID",CommonProperties.FilterIV);
objcomm.Parameters.Add(
"@.FILTER_DOMAINID",CommonProperties.FilterDomain);
objcomm.Parameters.Add(
"@.FILTER_SOURCEID",CommonProperties.FilterSource);
objcomm.Parameters.Add(
"@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
objcomm.Parameters.Add(
"@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
objcomm.Parameters.Add(
"@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
objcomm.Parameters.Add(
"@.FILTER_EMAILID",CommonProperties.Filteremail);
objcomm.Parameters.Add(
"@.FILTER_PHONENO",CommonProperties.Filterphone);
objcomm.Parameters.Add(
"@.FILTER_ROLEID",CommonProperties.Filterroleid);
objcomm.Parameters.Add(
"@.FILTER_USERID",CommonProperties.Filteruserid);
objcomm.Parameters.Add(
"@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
objcomm.Parameters.Add(
"@.FILTER_INVERTICALID",CommonProperties.FilterIV);
objcomm.Parameters.Add(
"@.FILTER_DOMAINID",CommonProperties.FilterDomain);
objcomm.Parameters.Add(
"@.FILTER_SOURCEID",CommonProperties.FilterSource);
objcomm.Parameters.Add(
"@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
objcomm.Parameters.Add(
"@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
objcomm.Parameters.Add(
"@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
objcomm.Parameters.Add(
"@.FILTER_EMAILID",CommonProperties.Filteremail);
objcomm.Parameters.Add(
"@.FILTER_PHONENO",CommonProperties.Filterphone);*/
objcomm.Parameters.Add( "@.FILTER_ROLEID",Session["Filterroleid"]);
objcomm.Parameters.Add( "@.FILTER_USERID",Session["Filteruserid"]);
objcomm.Parameters.Add(
"@.FILTER_COMPANYID",Session["FilterCompanyId"].ToString());
objcomm.Parameters.Add(
"@.FILTER_INVERTICALID",Session["FilterIV"]);
objcomm.Parameters.Add(
"@.FILTER_DOMAINID",Session["FilterDomain"]);
objcomm.Parameters.Add(
"@.FILTER_SOURCEID",Session["FilterSource"]);
objcomm.Parameters.Add(
"@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
objcomm.Parameters.Add(
"@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
objcomm.Parameters.Add(
"@.FILTER_DESIGNATION",Session["FilterDesignation"]);
objcomm.Parameters.Add( "@.FILTER_EMAILID",Session["Filteremail"]);
objcomm.Parameters.Add( "@.FILTER_PHONENO",Session["Filterphone"]);
objread=objcomm.ExecuteReader();
if (objread.HasRows)
{
while (objread.Read())
{
CheckBox check =
(CheckBox)plcompany.FindControl("chkcontact"+objread["contact_id"].ToString(
));
if (check.Checked==true)
{
string _chkdcompanyid=check.ID;
// if (CommonProperties.SelectedContact!=null)
if (Session["SelectedContact"].ToString()!="")
{
// CommonProperties.SelectedContact=CommonProperties.SelectedContact+","+_ch
kdcompanyid;
Session["SelectedContact"]=Session["SelectedContact"]+","+_chkdcompanyid;
}
else
{
//CommonProperties.SelectedContact=_chkdcompanyid;
Session["SelectedContact"]=_chkdcompanyid;
}
}
}
}
objcomm.Cancel();
objread.Close();
}
}
private void SelectLink_Click(object sender, System.EventArgs e)
{
CheckAllCompaniesContact();
}
private void CheckAllCompaniesContact()
{
try
{
// string []
CompanyCheckBoxIds=CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Split(new
char[] {','});
string []
CompanyCheckBoxIds=Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Spli
t(new
char[] {','});
foreach (string temp in CompanyCheckBoxIds)
{
CheckBox check = (CheckBox)plcompany.FindControl(temp);
check.Checked=true;
}
Session["SelectedCompany"]=Session["CompaniesCheckBoxIDsInLeftMenu"];
}
catch{}
try
{
//string []
ContactCheckBoxIds=CommonProperties.ContactCheckBoxIDsInLeftMenu.Split(new
char[] {','});
string []
ContactCheckBoxIds=Session["ContactCheckBoxIDsInLeftMenu"].ToString().Split(
new
char[] {','});
foreach (string temp in ContactCheckBoxIds)
{
CheckBox check = (CheckBox)plcompany.FindControl(temp);
check.Checked=true;
}
// CommonProperties.SelectedCompany=CommonProperties.CompaniesCheckBoxIDsIn
LeftMenu;
// CommonProperties.SelectedContact=CommonProperties.ContactCheckBoxIDsInLe
ftMenu;
Session["SelectedContact"]=Session["ContactCheckBoxIDsInLeftMenu"];
}
catch{}
}
private void ClearLink_Click(object sender, System.EventArgs e)
{
ClearAllCompaniesContact();
}
private void ClearAllCompaniesContact()
{
try
{
//string []
CompanyCheckBoxIds=CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Split(new
char[] {','});
string []
CompanyCheckBoxIds=Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Spli
t(new
char[] {','});
foreach (string temp in CompanyCheckBoxIds)
{
CheckBox check = (CheckBox)plcompany.FindControl(temp);
check.Checked=false;
}
Session["SelectedCompany"]=Session["CompaniesCheckBoxIDsInLeftMenu"]="";
//string []
ContactCheckBoxIds=CommonProperties.ContactCheckBoxIDsInLeftMenu.Split(new
char[] {','});
string []
ContactCheckBoxIds=Session["ContactCheckBoxIDsInLeftMenu"].ToString().Split(
new
char[] {','});
foreach (string temp in ContactCheckBoxIds)
{
CheckBox check = (CheckBox)plcompany.FindControl(temp);
check.Checked=false;
}
//CommonProperties.SelectedCompany=CommonProperties.CompaniesCheckBoxIDsInLe
ftMenu="";
//CommonProperties.SelectedContact=CommonProperties.ContactCheckBoxIDsInLeft
Menu="";
Session["SelectedContact"]=Session["ContactCheckBoxIDsInLeftMenu"]="";
}
catch{}
}
}
}
Ummm, no one is going to read this. Can you please attach the code that
is causing the problem?
aroraamit81@.gmail.com wrote:
> Patric Here goes my long code, if you could check it out, then I would
> be more than obliged to you...............
> namespace CMS
> {
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Web;
> using System.Web.SessionState;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.HtmlControls;
> using System.Data.SqlClient;
> using System.Configuration;
> using Properties;
> //using UserContorls;
> /// <summary>
> /// Summary description for DisplayCompanyContacts.
> /// </summary>
> public class DisplayCompanyContacts : System.Web.UI.UserControl
> {
> protected System.Web.UI.WebControls.PlaceHolder plcompany;
> LiteralControl litcontrol;
> protected System.Web.UI.WebControls.CheckBox CheckBox1;
> LiteralControl litcontrol2;
> string roleid,userid;
> protected System.Web.UI.WebControls.Button btn;
> protected System.Web.UI.WebControls.LinkButton ClearLink;
> protected System.Web.UI.HtmlControls.HtmlInputHidden CheckBoxFlag;
> protected System.Web.UI.HtmlControls.HtmlInputHidden CompanyID;
> protected System.Web.UI.WebControls.LinkButton SelectLink;
> private void Page_Load(object sender, System.EventArgs e)
> {
> //DisplayConversationFromCalander();
> if (Session["Userid"].ToString()=="")
> {
> Session.Abandon();
> Response.Redirect("Login.aspx");
> }
> Session["ContactCheckBoxIDsInLeftMenu"]="";
> Session["CompaniesCheckBoxIDsInLeftMenu"]="";
> //CommonProperties.ContactCheckBoxIDsInLeftMenu="";
> //CommonProperties.CompaniesCheckBoxIDsInLeftMenu="";
> roleid=Session["Roleid"].ToString().Trim();
> userid=Session["Userid"].ToString().Trim();
> //if(!IsPostBack)
> bindleftpanel();
>
> ///Removing these Common Properties and Placing Sessions Instead
> if(Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Length>0)
> Session["CompaniesCheckBoxIDsInLeftMenu"]=
> Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Substring
> (0,Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Length-1);
> if(Session["ContactCheckBoxIDsInLeftMenu"].ToString().Length>0)
> Session["ContactCheckBoxIDsInLeftMenu"]=
> Session["ContactCheckBoxIDsInLeftMenu"].ToString().Substring
> (0,Session["ContactCheckBoxIDsInLeftMenu"].ToString().Length-1);
> /* if(CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Length>0)
> CommonProperties.CompaniesCheckBoxIDsInLeftMenu=
> CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Substring
> (0,CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Length-1);
> if(CommonProperties.ContactCheckBoxIDsInLeftMenu.Length>0)
> CommonProperties.ContactCheckBoxIDsInLeftMenu=
> CommonProperties.ContactCheckBoxIDsInLeftMenu.Substring
> (0,CommonProperties.ContactCheckBoxIDsInLeftMenu.Length-1); */
>
> /* if (Request.Url!=null)
> {
> string _pageurl=Request.Url.ToString();
> char[] splitter = {'/'};
> string[] arInfo = _pageurl.Split(splitter);
> for(int x = 0; x < arInfo.Length; x++)
> {
> _pageurl=arInfo[x];
> }
> if (_pageurl=="ViewContact.aspx")
> {
> UserContorls.ViewContact viewcontact=new
> CMS.UserContorls.ViewContact();
> viewcontact.BindViewDetails();
> }
> } */
> }
> public void bindleftpanel()
> {
> using( SqlConnection strcon=new SqlConnection
> (ConfigurationSettings.AppSettings["CMSConnection"]))
> {
> SqlCommand objcomm;
> SqlDataReader objread;
> strcon.Open();
> //string sql;
> /*if (roleid=="1" || roleid=="2")
> {
> if (CommonProperties.FilterCompanyId==null)
> {
> sql="select * from company where COMPANY_ID in (Select COMPANY_ID
> from COMPANYALLOCATION where COMPANYALLOCATEDTO='"+userid+"' and
> USERROLEID="+roleid+" Union Select Company_id from Company where
> COMPANY_ADDEDBY='"+userid+"') order by company_name";
> }
> else
> {
> sql="select * from company where COMPANY_ID in (Select COMPANY_ID
> from COMPANYALLOCATION where COMPANYALLOCATEDTO='"+userid+"' and
> USERROLEID="+Session["Roleid"]+" Union Select Company_id from Company
> where COMPANY_ADDEDBY='"+userid+"') and
> company_id='"+CommonProperties.FilterCompanyId.ToString()+"' order by
> company_name";
> }
> }
> else
> {
> sql="select * from company order by company_name";
> }*/
> //objcomm=new SqlCommand(sql,strcon);
> //kapil kalra 20-mar-2006 permission check
> int permission=0;
> if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session
["RoleID"]),"Allow
> all Companies")))
> {
> permission=1;//full pemission
> }
> objcomm=new SqlCommand("Usp_LeftMenu_Company",strcon);
> objcomm.CommandType = CommandType.StoredProcedure;
> objcomm.Parameters.Clear();
> objcomm.Parameters.Add( "@.SESSION_ROLEID", roleid );
> objcomm.Parameters.Add( "@.SESSION_USERID", userid );
> objcomm.Parameters.Add( "@.permission", permission );
> /* objcomm.Parameters.Add(
> "@.FILTER_ROLEID",CommonProperties.Filterroleid);
> objcomm.Parameters.Add(
> "@.FILTER_USERID",CommonProperties.Filteruserid);
> objcomm.Parameters.Add(
> "@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
> objcomm.Parameters.Add(
> "@.FILTER_INVERTICALID",CommonProperties.FilterIV);
> objcomm.Parameters.Add(
> "@.FILTER_DOMAINID",CommonProperties.FilterDomain);
> objcomm.Parameters.Add(
> "@.FILTER_SOURCEID",CommonProperties.FilterSource);
> objcomm.Parameters.Add(
> "@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
> objcomm.Parameters.Add(
> "@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
> objcomm.Parameters.Add(
> "@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
> objcomm.Parameters.Add(
> "@.FILTER_EMAILID",CommonProperties.Filteremail);
> objcomm.Parameters.Add(
> "@.FILTER_PHONENO",CommonProperties.Filterphone);*/
> try
> {
> objcomm.Parameters.Add(
> "@.FILTER_ROLEID",Convert.ToInt32(Session["Filterroleid"]));
> objcomm.Parameters.Add(
> "@.FILTER_USERID",Convert.ToInt32(Session["Filteruserid"]));
> objcomm.Parameters.Add(
> "@.FILTER_COMPANYID",Session["FilterCompanyId"].ToString());
> objcomm.Parameters.Add(
> "@.FILTER_INVERTICALID",Convert.ToInt32(Session["FilterIV"]));
> objcomm.Parameters.Add(
> "@.FILTER_DOMAINID",Convert.ToInt32(Session["FilterDomain"]));
> objcomm.Parameters.Add(
> "@.FILTER_SOURCEID",Convert.ToInt32(Session["FilterSource"]));
> objcomm.Parameters.Add(
> "@.FILTER_WORKTYPEID",Convert.ToInt32(Session["FilterWorkType"]));
> objcomm.Parameters.Add(
> "@.FILTER_DISPOSITIONID",Convert.ToInt32(Session["FilterDisposition"]));
> objcomm.Parameters.Add(
> "@.FILTER_DESIGNATION",Session["FilterDesignation"].ToString());
> objcomm.Parameters.Add(
> "@.FILTER_EMAILID",Session["Filteremail"].ToString());
> objcomm.Parameters.Add(
> "@.FILTER_PHONENO",Session["Filterphone"].ToString());
> }
> catch
> {}
> objread=objcomm.ExecuteReader();
> //CommonProperties.CompaniesCheckBoxIDsInLeftMenu="";
> //Session["CompaniesCheckBoxIDsInLeftMenu"]="";
> if (objread.HasRows)
> {
> while (objread.Read())
> {
> CheckBox chkbox=new CheckBox();
> chkbox.ID="chkcompany"+objread["company_id"].ToString();
> //Response.Write(objread["company_id"]);
> chkbox.AutoPostBack=true;
> chkbox.EnableViewState=true;
> chkbox.Attributes.Add("onClick","java script:Foo(this);");
> chkbox.EnableViewState=true;
> //CommonProperties.CompaniesCheckBoxIDsInLeftMenu+=chkbox.ID+",";
> Session["CompaniesCheckBoxIDsInLeftMenu"]+=chkbox.ID+",";
> //if (CommonProperties.SelectedCompany!=null)
> if (Session["SelectedCompany"].ToString()!="" )
> {
> //string info_company =
> CommonProperties.SelectedCompany;
> string info_company =
> Session["SelectedCompany"].ToString();
> char[] splitter = {','};
> string[] arInfo = info_company.Split(splitter);
> for(int x = 0; x < arInfo.Length; x++)
> {
> if (chkbox.ID==arInfo[x])
> {
> chkbox.Checked=true;
> }
> }
> }
> chkbox.CheckedChanged+=new
> System.EventHandler(this.ASSIGN_CHECKED);
> plcompany.Controls.Add(chkbox);
> litcontrol=new LiteralControl();
> litcontrol.Text="<span
> class=FilterListCompany>"+objread["company_name"].ToString()+"</span><br>"
;
> plcompany.Controls.Add(litcontrol );
> subcontact(objread["company_id"].ToString());
> }
> }
> objcomm.Cancel();
> objread.Close();
> }
> }
>
> public void subcontact(string company_id)
> {
> using(SqlConnection strcon2=new SqlConnection
> (ConfigurationSettings.AppSettings["CMSConnection"]))
> {
> SqlCommand objcomm2;
> SqlDataReader objread2;
> strcon2.Open();
> //string sql2;
> int permission=0;
> if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session
["RoleID"]),"Allow
> all Companies")))
> {
> permission=1;//full pemission
> }
> objcomm2=new SqlCommand("Usp_LeftMenu_Contact",strcon2);
> objcomm2.CommandType = CommandType.StoredProcedure;
> objcomm2.Parameters.Clear();
> objcomm2.Parameters.Add( "@.SESSION_ROLEID", roleid );
> objcomm2.Parameters.Add( "@.SESSION_USERID", userid );
> objcomm2.Parameters.Add( "@.permission", permission );
> /* objcomm2.Parameters.Add(
> "@.FILTER_ROLEID",CommonProperties.Filterroleid);
> objcomm2.Parameters.Add(
> "@.FILTER_USERID",CommonProperties.Filteruserid);
> objcomm2.Parameters.Add(
> "@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
> objcomm2.Parameters.Add(
> "@.FILTER_INVERTICALID",CommonProperties.FilterIV);
> objcomm2.Parameters.Add(
> "@.FILTER_DOMAINID",CommonProperties.FilterDomain);
> objcomm2.Parameters.Add(
> "@.FILTER_SOURCEID",CommonProperties.FilterSource);
> objcomm2.Parameters.Add(
> "@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
> objcomm2.Parameters.Add(
> "@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
> objcomm2.Parameters.Add(
> "@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
> objcomm2.Parameters.Add(
> "@.FILTER_EMAILID",CommonProperties.Filteremail);
> objcomm2.Parameters.Add(
> "@.FILTER_PHONENO",CommonProperties.Filterphone);
> objcomm2.Parameters.Add( "@.FILTER_CONTACTCOMPANYID",company_id);*/
> objcomm2.Parameters.Add( "@.FILTER_ROLEID",Session["Filterroleid"]);
> objcomm2.Parameters.Add( "@.FILTER_USERID",Session["Filteruserid"]);
> objcomm2.Parameters.Add(
> "@.FILTER_COMPANYID",Session["FilterCompanyId"]);
> objcomm2.Parameters.Add(
> "@.FILTER_INVERTICALID",Session["FilterIV"]);
> objcomm2.Parameters.Add(
> "@.FILTER_DOMAINID",Session["FilterDomain"]);
> objcomm2.Parameters.Add(
> "@.FILTER_SOURCEID",Session["FilterSource"]);
> objcomm2.Parameters.Add(
> "@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
> objcomm2.Parameters.Add(
> "@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
> objcomm2.Parameters.Add(
> "@.FILTER_DESIGNATION",Session["FilterDesignation"]);
> objcomm2.Parameters.Add( "@.FILTER_EMAILID",Session["Filteremail"]);
> objcomm2.Parameters.Add( "@.FILTER_PHONENO",Session["Filterphone"]);
> objcomm2.Parameters.Add( "@.FILTER_CONTACTCOMPANYID",company_id);
> objread2=objcomm2.ExecuteReader();
> //CommonProperties.ContactCheckBoxIDsInLeftMenu="";
> //Session["ContactCheckBoxIDsInLeftMenu"]="";
> if (objread2.HasRows)
> {
> while(objread2.Read())
> {
> litcontrol2=new LiteralControl();
> litcontrol2.Text=" ";
> plcompany.Controls.Add(litcontrol2 );
> CheckBox chkbox=new CheckBox();
> chkbox.ID="chkcontact"+objread2["contact_id"].ToString();
> //CommonProperties.ContactCheckBoxIDsInLeftMenu+=chkbox.ID+",";
> Session["ContactCheckBoxIDsInLeftMenu"]+=chkbox.ID+",";
> chkbox.AutoPostBack=true;
> chkbox.EnableViewState=true;
> //if (CommonProperties.SelectedContact!=null)
> if (Session["SelectedContact"].ToString()!="")
> {
> //string info_company =
> CommonProperties.SelectedContact;
> string info_company =
> Session["SelectedContact"].ToString();
> char[] splitter = {','};
> string[] arInfo = info_company.Split(splitter);
> for(int x = 0; x < arInfo.Length; x++)
> {
> if (chkbox.ID==arInfo[x])
> {
> chkbox.Checked=true;
> }
> }
> }
> chkbox.CheckedChanged+=new
> System.EventHandler(this.Contact_Checked);
> plcompany.Controls.Add(chkbox);
> litcontrol2=new LiteralControl();
> if(roleid=="4" ||roleid=="5"||roleid=="6"||roleid=="7" )
> {
> int flag=ColorSeg(company_id,objread2["contact_id"].ToString());
> if(flag==0)//not alloted
> {
> litcontrol2.Text="<span
> class=FilterListContact>"+objread2["contact_name"].ToString()+"</span><br>
";
> }
> else if(flag==1)//alloted to RA
> {
> litcontrol2.Text="<span
> class=FilterListContactRA>"+objread2["contact_name"].ToString()+"</span><b
r>";
> }
> else if(flag==2)// alloted to SR
> {
> litcontrol2.Text="<span
> class=FilterListContactSR>"+objread2["contact_name"].ToString()+"</span><b
r>";
> }
> else// alloted to both
> {
> litcontrol2.Text="<span
> class=FilterListContactBoth>"+objread2["contact_name"].ToString()+"</span>
<br>";
> }
> }
> else
> {
> litcontrol2.Text="<span
> class=FilterListContact>"+objread2["contact_name"].ToString()+"</span><br>
";
> }
> plcompany.Controls.Add(litcontrol2 );
> }
> }
>
> objcomm2.Cancel();
> objread2.Close();
> strcon2.Close();
> }
> }
> private int ColorSeg(string company_id,string contactid)
> {
> int flag=0;
> string kk;
> string sql="SELECT userroleid FROM
> dbo.CONTACTSALLOCATION where CONTACT_ID="+contactid+" and userroleid
> in(1,2)";
> SqlConnection conn=new SqlConnection
> (ConfigurationSettings.AppSettings["CMSConnection"]);
> SqlCommand cmd=new SqlCommand();
> cmd.Parameters.Clear();
> cmd.CommandText="dbo.[Usp_LeftPanelColor]";
> cmd.CommandType=CommandType.StoredProcedure;
> cmd.Connection=conn;
> cmd.Parameters.Add("@.contactid",Convert.ToInt32(contactid));
> DataSet ds=new DataSet();
> SqlDataAdapter adpter=new SqlDataAdapter(cmd);
> adpter.Fill(ds);
> if(ds.Tables[0].Rows.Count>0)
> {
> kk= ds.Tables[0].Rows[0]["userroleid"].ToString();
> flag=Convert.ToInt32(kk);
> if(ds.Tables[0].Rows.Count>1)
> {
> flag=3;
> }
> }
> return flag;
> }
> #region Web Form Designer generated code
> override protected void OnInit(EventArgs e)
> {
> //
> // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> //
> InitializeComponent();
> base.OnInit(e);
> }
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> this.SelectLink.Click += new
> System.EventHandler(this.SelectLink_Click);
> this.ClearLink.Click += new
> System.EventHandler(this.ClearLink_Click);
> this.Load += new System.EventHandler(this.Page_Load);
> }
> #endregion
> public void ASSIGN_CHECKED(object sender, System.EventArgs e)
> {
> //CommonProperties.SelectedCompany=null;
> Session["SelectedCompany"]="";
> using( SqlConnection strcon=new SqlConnection
> (ConfigurationSettings.AppSettings["CMSConnection"]))
> {
> SqlCommand objcomm;
> SqlDataReader objread;
> strcon.Open();
> /*string sql;
> if (roleid=="1" || roleid=="2")
> {
> sql="select * from company where COMPANY_ID in (Select COMPANY_ID
> from COMPANYALLOCATION where COMPANYALLOCATEDTO='"+userid+"' and
> USERROLEID="+Session["Roleid"]+" Union Select Company_id from Company
> where COMPANY_ADDEDBY='"+userid+"') order by company_name";
> }
> else
> {
> sql="select * from company order by company_name";
> }
> objcomm=new SqlCommand(sql,strcon);*/
> int permission=0;
> if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session
["RoleID"]),"Allow
> all Companies")))
> {
> permission=1;//full pemission
> }
> objcomm=new SqlCommand("Usp_LeftMenu_Company",strcon);
> objcomm.CommandType = CommandType.StoredProcedure;
> objcomm.Parameters.Clear();
> objcomm.Parameters.Add( "@.SESSION_ROLEID", roleid );
> objcomm.Parameters.Add( "@.SESSION_USERID", userid );
> objcomm.Parameters.Add( "@.permission", permission );
> /*objcomm.Parameters.Add(
> "@.FILTER_ROLEID",CommonProperties.Filterroleid);
> objcomm.Parameters.Add(
> "@.FILTER_USERID",CommonProperties.Filteruserid);
> objcomm.Parameters.Add(
> "@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
> objcomm.Parameters.Add(
> "@.FILTER_INVERTICALID",CommonProperties.FilterIV);
> objcomm.Parameters.Add(
> "@.FILTER_DOMAINID",CommonProperties.FilterDomain);
> objcomm.Parameters.Add(
> "@.FILTER_SOURCEID",CommonProperties.FilterSource);
> objcomm.Parameters.Add(
> "@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
> objcomm.Parameters.Add(
> "@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
> objcomm.Parameters.Add(
> "@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
> objcomm.Parameters.Add(
> "@.FILTER_EMAILID",CommonProperties.Filteremail);
> objcomm.Parameters.Add(
> "@.FILTER_PHONENO",CommonProperties.Filterphone);*/
> objcomm.Parameters.Add( "@.FILTER_ROLEID",Session["Filterroleid"]);
> objcomm.Parameters.Add( "@.FILTER_USERID",Session["Filteruserid"]);
> objcomm.Parameters.Add(
> "@.FILTER_COMPANYID",Session["FilterCompanyId"]);
> objcomm.Parameters.Add(
> "@.FILTER_INVERTICALID",Session["FilterIV"]);
> objcomm.Parameters.Add(
> "@.FILTER_DOMAINID",Session["FilterDomain"]);
> objcomm.Parameters.Add(
> "@.FILTER_SOURCEID",Session["FilterSource"]);
> objcomm.Parameters.Add(
> "@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
> objcomm.Parameters.Add(
> "@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
> objcomm.Parameters.Add(
> "@.FILTER_DESIGNATION",Session["FilterDesignation"]);
> objcomm.Parameters.Add( "@.FILTER_EMAILID",Session["Filteremail"]);
> objcomm.Parameters.Add( "@.FILTER_PHONENO",Session["Filterphone"]);
> objread=objcomm.ExecuteReader();
> if (objread.HasRows)
> {
> while (objread.Read())
> {
> CheckBox check =
> (CheckBox)plcompany.FindControl("chkcompany"+objread["company_id"].ToStrin
g());
> string _unchkdcompanyid=check.ID;
> if (check.Checked==true)
> {
> string _chkdcompanyid=check.ID;
> //if (CommonProperties.SelectedCompany!=null)
> if (Session["SelectedCompany"].ToString().Trim()!="" )
> {
> //CommonProperties.SelectedCompany=CommonProperties.SelectedCompan
y+","+_chkdcompanyid;
> Session["SelectedCompany"]=Session["SelectedCompany"]+","+_chkdcom
panyid;
> ChkContact(_chkdcompanyid);
> }
> else
> {
> //CommonProperties.SelectedCompany=_chkdcompanyid;
> Session["SelectedCompany"]=_chkdcompanyid;
> ChkContact(_chkdcompanyid);
> }
> }
> else
> {
> // UnChkContatct(_unchkdcompanyid);
> }
>
> }
> }
> if(Session["SelectedCompany"].ToString().StartsWith(","))
> {
> Session["SelectedCompany"]=Session["SelectedCompany"].ToString().Subs
tring(1,Session["SelectedCompany"].ToString().Length);
> }
> if(Session["SelectedCompany"].ToString().EndsWith(","))
> {
> Session["SelectedCompany"]=Session["SelectedCompany"].ToString().Subs
tring(0,Session["SelectedCompany"].ToString().Length-1);
> }
> if(Session["SelectedContact"].ToString().StartsWith(","))
> {
> Session["SelectedContact"]=Session["SelectedContact"].ToString().Subs
tring(1,Session["SelectedContact"].ToString().Length);
> }
> if(Session["SelectedContact"].ToString().EndsWith(","))
> {
> Session["SelectedContact"]=Session["SelectedContact"].ToString().Subs
tring(0,Session["SelectedContact"].ToString().Length-1);
> }
> objcomm.Cancel();
> objread.Close();
> }
> string FlagStatus=CheckBoxFlag.Value.ToString();
> string strCompanyID=CompanyID.Value.ToString();
> strCompanyID=strCompanyID.Substring(strCompanyID.LastIndexOf("_")+1);
>
> if(!Convert.ToBoolean(FlagStatus))
> UnChkContatct(strCompanyID);
>
> }
>
> public void ChkContact(string chkedCmpy)
> {
> chkedCmpy=chkedCmpy.Replace("chkcompany","");
>
> SqlConnection conn=new
> SqlConnection(ConfigurationSettings.AppSettings["CMSConnection"]);
> conn.Open();
> // SqlCommand cmdcontact=new SqlCommand("Select CONTACT_ID from
> Contacts where CONTACT_COMPANY_ID='"+chkedCmpy+"'", conn);
> int permission=0;
> if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session[
"RoleID"]),"Allow
> all Companies")))
> {
> permission=1;//full pemission
> }
> SqlCommand cmdcontact=new SqlCommand("AutoChkContacts",conn);
> cmdcontact.CommandType = CommandType.StoredProcedure;
> cmdcontact.Parameters.Add( "@.SESSION_ROLEID", roleid );
> cmdcontact.Parameters.Add( "@.SESSION_USERID", userid );
> cmdcontact.Parameters.Add( "@.permission", permission );
> /*cmdcontact.Parameters.Add(
> "@.FILTER_ROLEID",CommonProperties.Filterroleid);
> cmdcontact.Parameters.Add(
> "@.FILTER_USERID",CommonProperties.Filteruserid);
> cmdcontact.Parameters.Add(
> "@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
> cmdcontact.Parameters.Add(
> "@.FILTER_INVERTICALID",CommonProperties.FilterIV);
> cmdcontact.Parameters.Add(
> "@.FILTER_DOMAINID",CommonProperties.FilterDomain);
> cmdcontact.Parameters.Add(
> "@.FILTER_SOURCEID",CommonProperties.FilterSource);
> cmdcontact.Parameters.Add(
> "@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
> cmdcontact.Parameters.Add(
> "@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
> cmdcontact.Parameters.Add(
> "@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
> cmdcontact.Parameters.Add(
> "@.FILTER_EMAILID",CommonProperties.Filteremail);
> cmdcontact.Parameters.Add(
> "@.FILTER_PHONENO",CommonProperties.Filterphone);*/
> cmdcontact.Parameters.Add(
> "@.FILTER_ROLEID",Session["Filterroleid"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_USERID",Session["Filteruserid"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_COMPANYID",Session["FilterCompanyId"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_INVERTICALID",Session["FilterIV"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_DOMAINID",Session["FilterDomain"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_SOURCEID",Session["FilterSource"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_DESIGNATION",Session["FilterDesignation"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_EMAILID",Session["Filteremail"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_PHONENO",Session["Filterphone"]);
> cmdcontact.Parameters.Add( "@.FILTER_CONTACTCOMPANYID", chkedCmpy );
> SqlDataReader rdr=cmdcontact.ExecuteReader();
> if(rdr.HasRows)
> {
> while(rdr.Read())
> {
> CheckBox check =
> (CheckBox)plcompany.FindControl("chkcontact"+rdr["CONTACT_ID"].ToString())
;
> check.Checked=true;
>
> string _chkdcontactid=check.ID;
>
> //if (CommonProperties.SelectedContact!=null)
> if (Session["SelectedContact"].ToString()!="")
> {
> int flag=AldyInsertCont(_chkdcontactid);
> if(flag==0)
> //CommonProperties.SelectedContact=CommonProperties.SelectedContact
+","+_chkdcontactid;
> Session["SelectedContact"]=Session["SelectedContact"]+","+_chkdcont
actid;
> }
> else
> {
> //CommonProperties.SelectedContact=_chkdcontactid;
> Session["SelectedContact"]=_chkdcontactid;
> }
> }
> }
> }
> private int AldyInsertCont(string contid)
> {
> int flag=0;
> string[] Cont=Session["SelectedContact"].ToString().Split(new char[]
> {','});
> for(int i=0;i<Cont.Length;i++)
> {
> if(contid==Cont[i].ToString())
> {
> flag=1;
> break;
> }
> }
> return flag;
> }
> public void UnChkContatct(string chkedCmpy)
> {
> string chkedCmpy1=chkedCmpy;
> chkedCmpy=chkedCmpy.Replace("chkcompany","");
> SqlConnection conn=new
> SqlConnection(ConfigurationSettings.AppSettings["CMSConnection"]);
> conn.Open();
> int permission=0;
> if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session[
"RoleID"]),"Allow
> all Companies")))
> {
> permission=1;//full pemission
> }
> SqlCommand cmdcontact=new SqlCommand("AutoChkContacts",conn);
> cmdcontact.CommandType = CommandType.StoredProcedure;
> cmdcontact.Parameters.Clear();
> cmdcontact.Parameters.Add( "@.SESSION_ROLEID", roleid );
> cmdcontact.Parameters.Add( "@.SESSION_USERID", userid );
> cmdcontact.Parameters.Add( "@.permission", permission );
> /*cmdcontact.Parameters.Add(
> "@.FILTER_ROLEID",CommonProperties.Filterroleid);
> cmdcontact.Parameters.Add(
> "@.FILTER_USERID",CommonProperties.Filteruserid);
> cmdcontact.Parameters.Add(
> "@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
> cmdcontact.Parameters.Add(
> "@.FILTER_INVERTICALID",CommonProperties.FilterIV);
> cmdcontact.Parameters.Add(
> "@.FILTER_DOMAINID",CommonProperties.FilterDomain);
> cmdcontact.Parameters.Add(
> "@.FILTER_SOURCEID",CommonProperties.FilterSource);
> cmdcontact.Parameters.Add(
> "@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
> cmdcontact.Parameters.Add(
> "@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
> cmdcontact.Parameters.Add(
> "@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
> cmdcontact.Parameters.Add(
> "@.FILTER_EMAILID",CommonProperties.Filteremail);
> cmdcontact.Parameters.Add(
> "@.FILTER_PHONENO",CommonProperties.Filterphone);*/
>
> cmdcontact.Parameters.Add(
> "@.FILTER_ROLEID",Session["Filterroleid"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_USERID",Session["Filteruserid"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_COMPANYID",Session["FilterCompanyId"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_INVERTICALID",Session["FilterIV"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_DOMAINID",Session["FilterDomain"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_SOURCEID",Session["FilterSource"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_DESIGNATION",Session["FilterDesignation"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_EMAILID",Session["Filteremail"]);
> cmdcontact.Parameters.Add(
> "@.FILTER_PHONENO",Session["Filterphone"]);
>
> cmdcontact.Parameters.Add( "@.FILTER_CONTACTCOMPANYID", chkedCmpy );
> SqlDataReader rdr=cmdcontact.ExecuteReader();
>
> // string[] ChkContacts=CommonProperties.SelectedContact.Split(new
> char[] {','});
> // CommonProperties.SelectedContact=null;
> if(rdr.HasRows)
> {
> while(rdr.Read())
> {
> CheckBox check1 = (CheckBox)plcompany.FindControl(chkedCmpy1);
>
> CheckBox check =
> (CheckBox)plcompany.FindControl("chkcontact"+rdr["CONTACT_ID"].ToString())
;
>
> //if(CommonProperties.SelectedContact!=null)
> if(Session["SelectedContact"].ToString()!="")
> {
> /* if(CommonProperties.SelectedContact.IndexOf(check.ID.ToString()+"
,")>-1)
> CommonProperties.SelectedContact=CommonProperties.SelectedContact.
Replace(check.ID.ToString()+",","");
> else
> if(CommonProperties.SelectedContact.IndexOf(check.ID.ToString())>-1)
> CommonProperties.SelectedContact=CommonProperties.SelectedContact.
Replace(check.ID.ToString(),"");*/
> if(Session["SelectedContact"].ToString().IndexOf(check.ID.ToString()
+",")>-1)
> Session["SelectedContact"]=Session["SelectedContact"].ToString().Re
place(check.ID.ToString()+",","");
> else
> if(Session["SelectedContact"].ToString().IndexOf(check.ID.ToString())>-1)
> Session["SelectedContact"]=Session["SelectedContact"].ToString().Re
place(check.ID.ToString(),"");
>
> }
>
> // CommonProperties.SelectedContact=null;
>
> check.Checked=false;
> }
>
> }
> }
>
>
> public void Contact_Checked(object sender, System.EventArgs e)
> {
> // CommonProperties.SelectedContact=null;
> Session["SelectedContact"]="";
>
> using( SqlConnection strcon=new SqlConnection
> (ConfigurationSettings.AppSettings["CMSConnection"]))
> {
> SqlCommand objcomm;
> SqlDataReader objread;
> strcon.Open();
> /*string sql;
> if ( roleid=="2")
> {
> sql="select * from contacts where CONTACT_ID IN (Select CONTACT_ID
> from Contacts where CONTACT_UPDATE_BY_ID='"+userid+"' UNION Select
> CONTACT_ID from CONTACTSALLOCATION where
> CONTACTSALLOCATEDTO='"+userid+"' and USERROLEID="+Session["Roleid"]+")
> order by contact_name";
> }
> else if(roleid=="1" )
> {
> sql="select * from contacts where CONTACT_ID IN (Select CONTACT_ID
> from Contacts where CONTACT_UPDATE_BY_ID='"+userid+"' UNION Select
> CONTACT_ID from CONTACTSALLOCATION where
> CONTACTSALLOCATEDTO='"+userid+"' and USERROLEID="+Session["Roleid"]+"
> Union Select CONTACT_ID from Contacts where contact_company_id in
> (select COMPANY_ID from company where COMPANY_ID in (Select COMPANY_ID
> from COMPANYALLOCATION where COMPANYALLOCATEDTO='"+userid+"' and
> USERROLEID="+Session["Roleid"]+" Union Select Company_id from Company
> where COMPANY_ADDEDBY='"+userid+"'))) order by contact_name";
> }
> else
> {
> sql="select * from contacts order by contact_name";
> }
> //Response.Write (sql);
> //Response.End();
> objcomm=new SqlCommand(sql,strcon);*/
> int permission=0;
> if((CommonRules.CommonLogic.isValidServiceItem(Convert.ToInt32(Session
["RoleID"]),"Allow
> all Companies")))
> {
> permission=1;//full pemission
> }
> objcomm=new SqlCommand("Usp_LeftMenu_Contact_Checked",strcon);
> objcomm.CommandType = CommandType.StoredProcedure;
> objcomm.Parameters.Add( "@.SESSION_ROLEID", roleid );
> objcomm.Parameters.Add( "@.SESSION_USERID", userid );
> objcomm.Parameters.Add( "@.permission", permission );
> /* objcomm.Parameters.Add(
> "@.FILTER_ROLEID",CommonProperties.Filterroleid);
> objcomm.Parameters.Add(
> "@.FILTER_USERID",CommonProperties.Filteruserid);
> objcomm.Parameters.Add(
> "@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
> objcomm.Parameters.Add(
> "@.FILTER_INVERTICALID",CommonProperties.FilterIV);
> objcomm.Parameters.Add(
> "@.FILTER_DOMAINID",CommonProperties.FilterDomain);
> objcomm.Parameters.Add(
> "@.FILTER_SOURCEID",CommonProperties.FilterSource);
> objcomm.Parameters.Add(
> "@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
> objcomm.Parameters.Add(
> "@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
> objcomm.Parameters.Add(
> "@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
> objcomm.Parameters.Add(
> "@.FILTER_EMAILID",CommonProperties.Filteremail);
> objcomm.Parameters.Add(
> "@.FILTER_PHONENO",CommonProperties.Filterphone);
> objcomm.Parameters.Add(
> "@.FILTER_ROLEID",CommonProperties.Filterroleid);
> objcomm.Parameters.Add(
> "@.FILTER_USERID",CommonProperties.Filteruserid);
> objcomm.Parameters.Add(
> "@.FILTER_COMPANYID",CommonProperties.FilterCompanyId);
> objcomm.Parameters.Add(
> "@.FILTER_INVERTICALID",CommonProperties.FilterIV);
> objcomm.Parameters.Add(
> "@.FILTER_DOMAINID",CommonProperties.FilterDomain);
> objcomm.Parameters.Add(
> "@.FILTER_SOURCEID",CommonProperties.FilterSource);
> objcomm.Parameters.Add(
> "@.FILTER_WORKTYPEID",CommonProperties.FilterWorkType);
> objcomm.Parameters.Add(
> "@.FILTER_DISPOSITIONID",CommonProperties.FilterDisposition);
> objcomm.Parameters.Add(
> "@.FILTER_DESIGNATION",CommonProperties.FilterDesignation);
> objcomm.Parameters.Add(
> "@.FILTER_EMAILID",CommonProperties.Filteremail);
> objcomm.Parameters.Add(
> "@.FILTER_PHONENO",CommonProperties.Filterphone);*/
> objcomm.Parameters.Add( "@.FILTER_ROLEID",Session["Filterroleid"]);
> objcomm.Parameters.Add( "@.FILTER_USERID",Session["Filteruserid"]);
> objcomm.Parameters.Add(
> "@.FILTER_COMPANYID",Session["FilterCompanyId"].ToString());
> objcomm.Parameters.Add(
> "@.FILTER_INVERTICALID",Session["FilterIV"]);
> objcomm.Parameters.Add(
> "@.FILTER_DOMAINID",Session["FilterDomain"]);
> objcomm.Parameters.Add(
> "@.FILTER_SOURCEID",Session["FilterSource"]);
> objcomm.Parameters.Add(
> "@.FILTER_WORKTYPEID",Session["FilterWorkType"]);
> objcomm.Parameters.Add(
> "@.FILTER_DISPOSITIONID",Session["FilterDisposition"]);
> objcomm.Parameters.Add(
> "@.FILTER_DESIGNATION",Session["FilterDesignation"]);
> objcomm.Parameters.Add( "@.FILTER_EMAILID",Session["Filteremail"]);
> objcomm.Parameters.Add( "@.FILTER_PHONENO",Session["Filterphone"]);
>
>
> objread=objcomm.ExecuteReader();
> if (objread.HasRows)
> {
> while (objread.Read())
> {
> CheckBox check =
> (CheckBox)plcompany.FindControl("chkcontact"+objread["contact_id"].ToStrin
g());
> if (check.Checked==true)
> {
> string _chkdcompanyid=check.ID;
> // if (CommonProperties.SelectedContact!=null)
> if (Session["SelectedContact"].ToString()!="")
> {
> // CommonProperties.SelectedContact=CommonProperties.SelectedConta
ct+","+_chkdcompanyid;
> Session["SelectedContact"]=Session["SelectedContact"]+","+_chkdcom
panyid;
> }
> else
> {
> //CommonProperties.SelectedContact=_chkdcompanyid;
> Session["SelectedContact"]=_chkdcompanyid;
> }
> }
> }
> }
> objcomm.Cancel();
> objread.Close();
> }
> }
> private void SelectLink_Click(object sender, System.EventArgs e)
> {
> CheckAllCompaniesContact();
> }
> private void CheckAllCompaniesContact()
> {
> try
> {
> // string []
> CompanyCheckBoxIds=CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Split(n
ew
> char[] {','});
> string []
> CompanyCheckBoxIds=Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Sp
lit(new
> char[] {','});
> foreach (string temp in CompanyCheckBoxIds)
> {
> CheckBox check = (CheckBox)plcompany.FindControl(temp);
> check.Checked=true;
> }
> Session["SelectedCompany"]=Session["CompaniesCheckBoxIDsInLeftMenu"];
> }
> catch{}
> try
> {
> //string []
> ContactCheckBoxIds=CommonProperties.ContactCheckBoxIDsInLeftMenu.Split(new
> char[] {','});
> string []
> ContactCheckBoxIds=Session["ContactCheckBoxIDsInLeftMenu"].ToString().Spli
t(new
> char[] {','});
> foreach (string temp in ContactCheckBoxIds)
> {
> CheckBox check = (CheckBox)plcompany.FindControl(temp);
> check.Checked=true;
> }
> // CommonProperties.SelectedCompany=CommonProperties.CompaniesCheckBo
xIDsInLeftMenu;
> // CommonProperties.SelectedContact=CommonProperties.ContactCheckBoxI
DsInLeftMenu;
> Session["SelectedContact"]=Session["ContactCheckBoxIDsInLeftMenu"];
> }
> catch{}
> }
> private void ClearLink_Click(object sender, System.EventArgs e)
> {
> ClearAllCompaniesContact();
> }
> private void ClearAllCompaniesContact()
> {
> try
> {
> //string []
> CompanyCheckBoxIds=CommonProperties.CompaniesCheckBoxIDsInLeftMenu.Split(n
ew
> char[] {','});
> string []
> CompanyCheckBoxIds=Session["CompaniesCheckBoxIDsInLeftMenu"].ToString().Sp
lit(new
> char[] {','});
> foreach (string temp in CompanyCheckBoxIds)
> {
> CheckBox check = (CheckBox)plcompany.FindControl(temp);
> check.Checked=false;
> }
> Session["SelectedCompany"]=Session["CompaniesCheckBoxIDsInLeftMenu"]="
";
> //string []
> ContactCheckBoxIds=CommonProperties.ContactCheckBoxIDsInLeftMenu.Split(new
> char[] {','});
> string []
> ContactCheckBoxIds=Session["ContactCheckBoxIDsInLeftMenu"].ToString().Spli
t(new
> char[] {','});
> foreach (string temp in ContactCheckBoxIds)
> {
> CheckBox check = (CheckBox)plcompany.FindControl(temp);
> check.Checked=false;
> }
> //CommonProperties.SelectedCompany=CommonProperties.CompaniesCheckBoxI
DsInLeftMenu="";
> //CommonProperties.SelectedContact=CommonProperties.ContactCheckBoxIDs
InLeftMenu="";
> Session["SelectedContact"]=Session["ContactCheckBoxIDsInLeftMenu"]="";
> }
> catch{}
> }
>
>
> }
> }
>
Well, the problem is this code only............
If you could solve it then please seee...