Quick question: Is there a "per-user" data storage object (similar to Session) that I can store data in the global scope (similar to HttpRuntime.Cache)? Almost as if Session and HttpRuntime.Cache had a baby.
Full Background: I have a ASP.NET website that was originally written for a single thread. Now I changed it so that certain actions will spawn a background thread and the browser polls a service to get status updates.
The problem I am having with this is that certain pieces of data are stored into the HttpContext.Session[] object (membership authentication token, for example). These pieces of data need to be unique to each user and accessible to the background thread. Session is not available to the background thread.
I am aware of HttpRuntime.Cache but that would require micromanagement to segment out the users and to expire it at the same time the session is expired. Session, on the other hand, automatically expires this things at the right times that I want it too and is already used by things like the SqlMembershipProvider.
My question is, is there something that behaves similar to the Session but exists in the global scope?
Now this code does run through all the images, but i need to alter the querystring and make it change to match the ID of the photo displayed. I tried adding QueryStringField="String" but this was hopeless.
I have a querystring like so:-
Quote:
[URL]
When i click on next image i need it to change to something like:-
Quote:
[URL]
See the PhotoID has changed. But it currently does not do this. When i arrive on the page the PhotoID stays the same. I have been trying for a while and im starting to give up!
I want to initiate a class for each user at the start of the user's session so that a single class can be used throughout the user's session. I checked out this post but I'm not sure where I should be placing this Sessionhandler class. Inside global.asax? How do I go about accomplishing this?
I am developing a new project to list files and directories under an specified location on disk. I use normal methods like Directory.GetFiles() to achieve this task but the amount of files is getting very big (> 300000) and the site is becoming terrible slow.
I worked with Index server with previous versions of Asp.Net but I was wondering if there is a new way for my website running Asp.Net 4.0.
Also I heard something about Index Server is obsolete to achive file listings and search. Is there any new alternative?
I am working on a Report Module for a DNN website and have found that the reports do not show in the reportviewer control if there is no ScriptManager control on the module. I am not sure where but somewhere I read it was needed. THe problem is when it is on the module so the reportviewer works correctly I am getting some errors with my other controls( mainly drop downs I want to use for selecting the reports) I am not getting an error just the DDL is not showing up on the page when scriptmanager is included but it does show up when its not included of course then the reportviewer shows no report.
Was RouteValueDictionary intended for use with htmlAttributes? Is there an alternative? The only 'feature' RouteValueDictionary looks like its got is it has a constructor which accepts an object.
We're using ASP.NET and IIS 6.0. I realise that the definitions of applications, websites and virtual directories are ill-defined in IIS 6, and changed a lot in IIS 7. However, I'm stuck with IIS 6.0 for now.
We have a single web site defined in IIS, and a number of separate sub-sites in Virtual Directories.
The scheme looks like this:-
[URL]
[URL]
site1, site2, ... are virtual directories in IIS 6.0, under the "Default Web Site".
I need to use ASP.NET sessions and forms authentication in most of these sites, and I don't want them to share authentication data or session information at all.
Both the mechanisms currently depend on cookies. However, the cookies created by default use the same name, and have a path of "/" in the browser, meaning the sites' cookies will clash with each other.
Without changing the default name for each cookie, how can I enforce separation between my sub-sites? Do I need to change the virtual directories for IIS 6 "Applications"? Or is there some way in code to enforce a more limited scope for the cookies?
I create a menu control in a user contol, named as RightUserrControl.ascx.
and i kept this RightUserrControl.ascx in nearly in 200 pages.
every thing is working fine , but when ever i am going to any page the page loading is very slow, nearly each page is taking 1 minute to load.
set caching for the user control, if this is the case , do i need to declare output cache in all 200 pages or is there any alternative way to resolve this issue.
As a workaround for the fact that asp:Checkboxes don't have values, I am attempting to dynamically create the ID's of checkboxes in a DataList so that it inserts the primary keys into the control ID. This is surprisingly difficult.
I have placed a PlaceHolder in my DataList ItemTemplate, then in the ItemCreated I create the checkboxes using string.Format("Checkbox{0}", DataBinder(e.Item.DataItem, "ID")). The problem is that this only works in a non-postback condition, as on postback the DataItem is null. And of course ItemDataBound isn't called on PostBack so that won't work either.
I can't seem to find a good way to handle this short of if (IsPostback) dataList.Bind(), which i don't think is a good way to do it.
In my Application I am using one Modal popup extender. I have one Grid View with Item Template containing Link button. I want to set Target Control Id of Popup extender to link Button of the Item Template. As it is inside the Item Template I can not access it directly in the page.
So Is there any alternative to achieve the same functionality.
I added the following code to global.asax to load up several session variable when a session starts. I'm assuming that when a page goes to use the variable that I should be
1) checking at the page level that the value is valid not 0 when its not expected to be 0, not a zero-length string when its expected to have a length
2) have code at the page level that sets the values if the values have not been set as when the Session timeout, ideally putting the code in a class derived from Page and then deriving all of my pages from the new class so that the code does not have to be repeated in every page
we are working on a huge project(web application) in asp.net ajax & c#. Per day 300 memmbers will access our website for data entry.we are using mssql 2005.we implemented someany sessions in our project.now our application becomes very slow.We are planning to remove the sessions in our project.
I want a specific session variable (in my case Session["level"]) to expire either on the normal 20 min. timer or at 19:30 every day. Because I change a value in my database everyday at 19:30 and I want this session variable to be related to that value. Is this possible?
I have a problem with selecting a control from codebehind.
This is my scenario:
1. i get a string from a webservice (session): string boxstring = "<input type="text" id="MainContent_TextBoxStopRoadName01" name="ctl00$MainContent$TextBoxStopRoadName01">";
2. i insert this string to a <div id="boxcontainer"> from codebehind like this:
boxcontainer.InnerHtml=boxstring;
3. Page loads
4. User types text in the box, and clicks a button to submit it
5. How do i find this textfield from codebehind from its id? I would like to get the field as an TextBox control, but the text value is the most important.
I´ve tried several things, like Findcontrol("id") and Findcontrol("id").Findcontrol("id") and so on. But it doesent work.
Another thing does work though, if instead of a string I create the textfield as an TextBox control, and then insert it: BoxContainer.Controls.Add(TextBox); - then it works! But it is not a possible solution in my situation. I only have the textbox (among many other elements) in a string.
What would be good/scalable user session alternative in following scenario:
users don't have to have cookies enabled URL query string restriction of 255 characters is imposed lot of GET requests (no hidden form fields)application runs on serveral servers (web farm) some users connect over proxy (same IP) users connect over HTTPS 50 000 concurrent users
Whenever an unhandled exception occurs on our site, I want to:
Send a notification email Clear the user's session Send the user to a error page ("Sorry, a problem occurred...")
The first and last I've had working for a long time but the second is causing me some issues. My Global.asax.vb includes:
[Code]....
When I run a debug, I can see the session being cleared, but then on the next page the session is back again!
I eventually found a reference that suggests that changes to session will not be saved unless Server.ClearError is called. Unfortunately, if I add this (just below the line that sets "ex") then the CustomErrors redirect doesn't seem to kick in and I'm left with a blank page?
how to get sessions in the global.asax, but I still cant get it to work...for some reason my session throws NullExceptions..the sessions are set from another page add looks something like:
[Code]....
And once I try to get those session values I do the following in the Global.asax:
[Code]....
But as I said, for some reason I get a NullException once I try to get the values...and they do have the same session-name,so they shouldn't be null..
i dont know about Global.asax so give some information about it and also tell me about the implementation and use of session_start and session_end event. How to call Global.asax in our website.