Web Forms :: Manage Multiple Sites On A Session Variable?
Mar 30, 2011how to manage multiple sites on a session variable?
View 4 Replieshow to manage multiple sites on a session variable?
View 4 RepliesI have a problem to manage session variable in to different virtual directory. I need to access Session value from one virtual directory to another virtual directory. For Example I have a Web Site in my IIS with one page. Page 1
[Code]....
I have another virtual directory under the same Web Site with one page as follows.
Page 2
[Code]....
I can't access session value of Page 1 from Page2!I need to access Page 1 Session value from Page 2.
i have 2 different sites under different subdomains.
www.company.com
and e-order.company.com
i want to have SSO so i have tried to make a global cookie.
my question is :does the global cookie keeps the session variables when i am going from one site to another?
if not how can i pass a session variable for ex. session("userName") from one site to the other on redirect?
I'm having problems with retrieving multiple instances of a session variable from an InProc session state. In the following code I persist a simple BusinessObject into a session variable on the Page_Load event. On the click of a button I try to retrieve the object back into 2 new declared instances of the same BusinessObject. All works great until I change one of the properties in the first instance, it changes the second instance as well. Is this normal behaviour? I would have thought as these were new instances they wouldn't demonstrate static behaviour?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
' create a new instance of a business object and set a containg variable
Dim BO As New BusinessObject
BO.SomeVariable = "test"
' persist to inproc session
Session("BO") = BO
End If
End Sub
Protected Sub btnRetrieveSessionVariable_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnRetrieveSessionVariable.Click
' retrieve the session variable to a new instance of BusinessObject
Dim BO1 As New BusinessObject
If Not Session("BO") Is Nothing Then BO1 = Session("BO")
' retrieve the session variable to a new instance of BusinessObject...............................
consider this scenario: a user on my website has a profileID. There are some pluginID's associated with this profileID.
E.g.: User1 might have 2, 3 and 5 plugins associated with his profile.
When the user logs in, I store the profileID of the user in a session variable cod. ON a certain page, the user tries to edit the plugins associated with his profile. So, on that page, I have to retrieve those pluginID's from the DB.
I have applied this code but this fetches only the maximum pluginID from the DB and not all the pluginID's.
[Code]....
I was trying to figure out how can I store multiple pluginID's in this session variable?
I'm creating a shopping basket in ASP.NET using session variables to pass the data from a shopping.aspx page to basket.aspx, currently I have the pages passing the primary key of the product with a gridview on the basket.aspx used to display the data from the database.However this only works for one item at a time, how can I extended the session variable so multiple products can be added, as well as quantities etc?
View 4 RepliesI have a web application using window authentication. There are a search page and a edit page in the application. In search page, user can enter some search criterias in the textboxes and the search result will be displayed in the gridview by clicking the "Search" button. User can select any row from the gridview and it will take him to the edit page. In the edit page, there is a "Back" button to take the user back to the search page. I use session variables to remember what the search criterias the user entered in the textboxes and what page number the user was in the gridview. So when the user goes back to the search page, the textboxes are pre-populated with the search criterias and the gridview is displayed in the correct page number.
The problem is: If user1 opened one browser window and did a search using search criterias1, then user1 opened a 2nd browser window and did a search using search criterias2. When the user1 went back to the search page from the edit page using the first browser window, all the textboxes and page numbers are from the 2nd browser window, instead of the 1st one. Can anyone explain this problem to me and how to prevent it? It will be helpful too if you can give me some links about the similar problem. I am thinking if the same user logged on two different machines and did the search on each machine, what is the result?
I would like to wrap Session variables in a manner similar to that discussed on CodeProject.
[code]....
Here is my question: if I have to access CurrentUser multiple times in the same page, would I get a performance improvement by assigning it to a local variable instead of accessing the wrapping property? Or does the HttpSessionState make sure the object is only deserialized once per request, so that subsequent calls in the same http request don't cost any more?
I want to be able to persist data across a session but do this outside of the built-in session state object. Why is a long story that I will not go into here. I just need to know where I can put data other than in the session object that will persist across the specific session.
View 3 RepliesI want to store employee name,designation and department in session variable and retrieve in another page how to do this.
View 2 RepliesI am working on a website and this is my first web project. Scenario for Session I have created a database for my project with security level little bit high. I want to manage session for each and every user who is logging in to my website. Session state can be used using Cookie as well as URL, only one at a time. Now I went over with all four session state modes. i.e 1. InProc 2. State Server 3. Sql Server 4. Custom
Now after reviewing from all these modes I am in confusion which one should I use Sql Server or Custom. Basically i want to store session related information in my own database instead of Aspnet_db which is a default database provided by microsoft. I have created all tables related to login and registration. But I dont know how to store session into my database. What tables do I need to create so as to maintain into database. I want to create a complete log of session and login related information into my database(Persistant atleast for 1 year). I want to use machinekey as AES and SHA1.
<sessionState mode="Custom" cookieless="AutoDetect" timeout="15" regenerateExpiredSessionId="true" stateNetworkTimeout="10" >
</sessionState>
<machineKey decryption="AES"
validation="SHA1"
decryptionKey="7E047D50A7E430181CCAF7E0D1771330D15D8A58AEDB8A1158F97EEF59BEB45D"
validationKey="68B439A210151231F3DBB3F3985E220CFEFC0662196B301B84105807E3AD27B6475DFC8BB546EC69421F38C1204ACFF7914188B5003C1DCF3E903E01A03C8578"/>
<add name="conString" connectionString="Data Source=192.168.1.5; Initial Catalog=dbName; Integrated Security=True;" providerName="System.Data.SqlClient" />
What all things do i need to specify in webconfig? My Data Source= 192.168.1.5 Database name= db.mdf What I need to know about. What tables do i need to add to my database to store session related information. eg. Session id (Any other field is also stored or not), Session Time, Session Start Time, Session End Time, Session Expire Time. I dont know what all things are usually taken. Do I need to encrypt Session Id
before storing into database. If Yes Encryption will be automatic or do i need to write some code to do this other than that I wrote in web config above. How mode='custom' will be used into web config using my database. in following code
<sessionState mode="Custom" cookieless="AutoDetect" timeout="15" regenerateExpiredSessionId="true" stateNetworkTimeout="10" >
</sessionState>
Currently in an .aspx file, I am storing a value (filename that was created in that session) in an hidden text box. When the user clicks on the "Print" labeled Hyperlink control, it opens the file that was stored in the hidden text box control. But when the user goes to different screen (in the same session), I loose the filename value that is stored in the hidden text box control. So I would like to store the filename variable in a session variable. So that if the user leaves this .aspx file and comes back to this .aspx file I can load the value into the hidden text box from the session variable.
View 11 RepliesI have a set of 4 separate RadioButton lists that all have different ID names. I know how to set each one up with a required Validation Control to check to make sure at least one button is selected in a particular list. However, what I want to do is have one control validator that is able to check all 4 lists, and make sure that at least one button is selected, no matter from what list.
In other words, when the submit button I have is selected, it looks at all 4 lists. If no radio buttons are selected from any of the 4 lists, it pops up with the required field control validator message. If at least one button out of the 4 lists is selected, it submits just fine.
I will like to imitate the behaviour of the site ClickBank.com, for example:Open the site, and login, if i open a tab with the same site, it ask me again to login.It makes me wonder how to manage one session per tab.Just to clarify, i don't loose control on the first tab if i log on in the new tab. They are separate sessions.
View 1 RepliesIn my .NET web app, I keep basic user info in a user session object. I also usually keep a director class in the session; which is basically just has info about whatever thing it being worked on on that screen (like a customer id).
I am trying to keep from adding a ton of sessions. I also want to make sure at any given time ONLY the sessions that are necessary are in memory.
This means I need an effective way of managing my session variables.
can we grab a global variable or Session or View State variable in the javascript or using jquery?
I have a web application which uses a session variable to store the logged in userid. If no user is logged in, of course this variable will be empty and the contents displayed on my website are meant for guests. If there is a user logged in, the user specific controls/access/links will then be a displayed.
I am now having issues with my hosting where on shared application pool, the worker recycle is triggered every 90 minutes, this will clear sessions causing all my users to be logged out. I opted for a dedicated application pool, which got worse because I am only allocated 50MB memory limit and if this is reached, the worker recycle is triggered and I lose my sessions again. I have tried as much as possible optimization techniques, e.g. dispose where possible, close connections, disable viewstate for static controls etc but my memory per instance keeps building up from page to page without any signs of improvement. I don't use loops nor store huge objects like bitmaps etc but my sessions are now gone even faster than 90 minutes in shared application pool before.
I have considered using SQL Session State but there isn't a simple guide on using this with MySQL. I am getting desperate and considering using a public variable, a string as a replacement to store logged in user id instead of in a session variable. I am pretty sure this will solve my issue with sessions being recycled but are there any negative consequences of doing this? One problem I can think of is if the user closes the browser, the system will never know that the user is now logged out and this public variable should be nothing. In this scenario, will the GC eventually clear this abandoned public variable.
I have two exactly the same web sites hosted in two different machines under IIS 7.5.
ASP.NET state service is running on my machine and the web.config is updated in both sites with the following code:
<sessionState mode="StateServer" stateConnectionString="tcpip=192.168.1.77:42424" cookieless="false" timeout="120"/>
The allow remote connection is set to 1 in registry in order for the second web site to access the state server.Both web sites have the same machine key:
<machineKey validationKey="7CB8DF6872FB6B35DECD3A8F55582350FEE1FAB9BE6B930216056C1B5BA69A4C5777B3125A42C4AECB4419D43EC12F168FD1BB887469798093C3CAA2427B2B89"[code]....
Additionally both sites are configured in IIS to have the same Identifier.What I want to do is that both these sites share the same session data for example being able to do the following:
// At web site 1:
Session["key"] = "value"[code]....
The problem is that I can't manage to accomplish this test and really can't understand what I am doing wrong.
I am having some trouble getting a second site to work with SSL in IIS 6. The server is Windows Server 2003 Service Pack 2.
I am getting the error "IIS was unable to start the site, Another site may already be using the port you configured for this site. Please select an unused port"
Both sites have different IP address but are on port 443.
When I stop one - I can start the other. But cannot run both at the same time.
I have tried editing MetaBase.xml file as a workaround but the file seems to be readonly. When I go to save, I get prompted to create a file.
I have custom redirection implemented in a module. Do I have to modify each config for all sites or is there a more general approach?Also, I have files in App_Data for this module, which would cause replication.
View 1 RepliesAfter doing some research, I found that <sessionState> can be hosted in SQL Server allowing applications to read from the same source. Essentially my app has two sides: a WCF library and an ASP.NET MVC 3 web site, the WCF has authentication and other DB IO methods and the MVC does the display. Now, the MVC stores a value in the session and then the WCF reads it and creates another for the MVC to read later. Problem is, neither can read each others session data, they can write to the same repository but can't share.
How do I go about them sharing the same information? How can I tell <sessionState> that the session started on the MVC side is the same as the WCF side and viceversa? I've tried
I have several ASP.NET sites, hosted on the same domain (different subdomains) and working via HTTPS. I have WCF service, hosted on the same domain. I have a separate state server for sessions.
All sites use cookieless session (if someone asks why - i will reply later, but it's a 'must')
On my sites, I use grid components from Telerik (but actually it does not matter) that ask for data from WCF service and must be filled with this data.
The problems are:
1) I cannot manage to make POST request to WCF service from javascript: for some reason it's always either GET or OPTIONS (no matter if I use Sys.Net.WebServiceProxy invoke or just a plain jquery AJAX request). It happens even if I indicate COOKIE mode, not cookieless. Maybe because of this I am getting "405 Method not allowed" error - WCF is set for POST request, but the site sends GET...
2) I cannot manage to retrieve SESSION from my websites! I tried approach, that I found, but WCF always uses OWN session, instead of 'connecting' to existing ASP.NET session, despite on ASP.NET compatibility mode. I need SESSION to exchange data between my sites and WCF service
3) I don't have idea currently, how to manage security when exchanging data between mentioned ones, in the light of above-mentioned problems...
4) I don't know exactly, how web.config for WCF service should look like in my case, because I've seen tons of different variants, but all for some simple cases.
Would be really appreciated for the help! I'm stuck for 2 or 3 weeks already, far behind the plan, but nothing still works... I can see there are some pieces of info about similar problems, but I'm afraid to miss some small thing - in web.config or method attribute or IIS setting, etc - and f... up everything.
I'm working on an ASP.NET MVC web application that will be deployed across multiple load-balanced servers. With this setup, a user might have one request served by server A and the next request will be served by ServerB or ServerC. We don't want to store Session Data in the database, as we're trying to minimise database hits where ever possible. As such, we need to have the HttpSession managed and stored on another server. My understanding is that this is possible by using a Windows Service that will manage this for me, but I'm unfamiliar with how to implement this. Can somebody point me at some good documentation on how to do this? Or any pitfalls or other points to take into consideration?
View 3 RepliesWe have used Session heavily in our application, we have created core classes (which have many properties) and store objects of core class in the session.
1) What could be the best solution for reflector activity?
2) What could be the best way to manage session in an application which has 100 pages?
What would be the proper syntax in ASP.NEt 3.5 C# to assign a TextBox value to a temporary or session variable to be manipulated (added, subtracted, multiplied, divided) at different points in the application? I want to add a decimal number to this variable in almost every instance as well.
View 3 Replies