Share Only One Instance Between Requests For Each User?
Sep 16, 2010
i have a class that must have only one instance, so i implemented the singleton pattern but with static every user that open the website page loads the data of the first user that called the class. How can i have a singleton pattern but with only one class instance for user?
I have hosted my web forms files and reports files two different IIS instance in same server. When user login i keep username inside session variable. According to that session variable i checking roles each web forms page load event. i share session variable between two difereent IIS instance in same server?
Imagine a website where individual clients can see each-other's presence - like a social network or a chatroom.
For example:
Client1 connects to my website.The back-end C# code updates a static field to indicate Client1's presence. Client2 connects to my website.Will the back-end C# code for the second request see the information stored in the static field from the first request? Is there anything I need to do to guarantee that these seperate instances of my ASP application are sharing static data?
I am showing thumbnail images in dataList on a page of my website. When i click on any image they open in big size. How i will share(Facebook). that particular big size image. My code is given below:
<script type="text/javascript"> var CurrentPage = 1; function GetImageIndex(obj) { while (obj.parentNode.tagName != "TD") obj = obj.parentNode; var td = obj.parentNode;
i have an asp.net project in vs2010 i have a db and table inside the app_data folder, i have created a deployment package and have imported the package into an iis server that is installed on my local mechine. now i get this error message while trying to preform an insertion.
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed the connection string is:
Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|survey.mdf;Integrated Security=True;User Instance=True
How do you handle ajax requests when user is not authenticated?
Someone enters the page, leaves room for an hour, returns, adds comment on the page that goes throuh ajax using jQuery ($.post). Since he is not authenticated, method return RedirectToRoute result (redirects to login page). What do you do with it? How do you handle it on client side and how do you handle it in controller?
In my ASP.NET MVC2 web app I have a page which goes off and gets results from a number of different web service feeds. These return times vary so I want to basically display them as they return after the page loads. I also want my user to be able to kick of requests that can run concurrently with these other requests.
At the minute my page just seems to queue up the requests. The web service calls returning one at a time in the order they are called and then the user can kick of requests.
Is this a case for the asyncController or is there an easier/better way of working this?
am new to web services and have a quick question. I've some data (an c# class object) that needs to be shared between two different users (of my web service) . all the methods in the web service have a parameter called "sessionkey" which can be used to know what data to share.
What's the simplest and most effective way to selectively redirect HTTP requests to your ASP.NET page to its HTTPS equivalent? For example, if my page site URL is [URL], I want to redirect some (or all) page requests to [URL] What's the easiest way to do that?
had made a site for client in which users can make request for songs, there's a db haing songname, by whome, written by, sang at etc the site is hosted and working fine the way the admin gets to know what is asked for is by using the website but now he wants that there be a desktop application which diplays all the requests so he does not have to log in and use the website..
I have a page on which I placed a user control. In this page I create an object ("FilterState") that maintains some state information. There are controls on the page which alter and read the FilterState, and the user control needs to be able to alter and read this same instance of FilterState. Meaning that there is code inside the user control that needs to refer to this object and manipulate it.I'm stuck on how to share the same instance between the page controls and this user control.
If I declare a FilterState object as a property of my user control, and set this property value to the instance I created in the page code behind, I'm assuming that it's really just getting a copy of it.
I need to create a singleton that would hold lots of data for a spedesign patterns - Singleton behavior with multi-user requests in ASP.NETcific user. However, I am not unclear as to what the behavior of that singleton is in regard to multi-user app requests.
Here is the scenario:
On AppStart event I want to load common data for all users (from SQL) and store it as a collection somewhere within the ASP.NET storage mechanisms.
If I store that data in the cache, I would also have to create a static property in the Global.asax that would provide access to that the data from the cache.
This is not ideal because whenever an instance of any particular page, or generic handler, or what have you tries to query this data using Linq the property has to load the data from the cache... introducing latency. I need this data to be immediately available. (think of it as about 5K rows of data stored in collection of objects...)
I was thinking to use a singleton to get that data, and store it but I don't know how it would behave between requests (and postbacks), as well as application instances, in terms of its persistence.
On PostAuthenticate event I want to get user specific data from SQL in the form of a collection. If i store it as a singleton (in a similar manner as the common data) i am not clear as to:
How is the data persisted? What is the scope of that singleton (it should be for the duration of the user session). How can I ensure that the data is immediately available to whatever needs to consume it? What happens between post-backs to that singleton? If another user logs in would another instance of that singleton be created for that specific application instance?
I am trying to assign user control from another user control ..first time its binding control successfully but when we refresh the data its giving error
saying "Object reference is not set an instance".
how to refresh data from another user control ...
My senerio below :
1 Aspx page
2. User control
calling usercontrol databinding method from aspx page but once it get refreshed ,not allowed to bind it again..
I've upload my web application on a localhost computer, and I got this error "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path.Please make sure the user has a local user profile on the computer."
I have an ASP.NET MVC application that attempts to read a file in using a filestream and File.OpenRead(). When the path to the file is a share on the same workgroup, and I give access to NETWORK SERVICE for the share, this works perfectly as desired.
However, when the path to the share is a UNC path to a remote share within the LAN, with read permissions open for "Everyone", the "File.OpenRead()" method throws an exception saying "Could not find a part of the path".
In my test cases I'm debugging locally with the ASP.NET MVC app being given a UNC path to the computer that it's actually running on. It's a share on my C drive, being "Shared" with permissions to "Everyone" for read access.
Is there something in IIS that needs to be configured? If I try to impersonate, in this context, the impersonation doesn't matter because NETWORK SERVICE was the user trying to access the files when it worked for a share in the same workgroup.
I'd like to add some custom instance properties to an ASP.Net User object. for example, I'd like to log every user's login and have something like: User.LoginTimes or calculate the User Profile's Completion percentage and be able to access it like: User.ProfileInfoPercentage, etc.
Now What I'd like to know is what would be the best approach to do this?
Forget about user instances? (e.g. define a database table with userid and ProfilePercentage info and retrieve data from profile like: DB.GetProfilePercentage(Context.Current.User.UserID) ) Override the ASP.Net User class and add my own functionalities. Use Extension methods for the user class.
I can't believe my eyes it's so hard to do just that ! Why can't I use MS Access instead of SQL Server Express ? So since I'm stucked with SQL Server Express, how can I make it work on my dedicated IIS 7 Server on Windows 2008 ?
I have copied under the root directory of the server. The website works until I try to login then I get:
Failed to generate a user instance of SQL Server
how to deploy this simple example used by Microsoft or can I ?
Update: in case it does matter I have installed SQL Server 2008 Express Advance Services Edition.
I have a user control that has multiple instances on a single page.
Is it possible to have each instance use a unique ValidationGroup? I could expose a property, but I'm wondering if there's any way to do it automatically.
i am trying to enter a value into a texbox that is placed inside a user control called CollectionRequest. i have referenced this user control in my code behind and created an instance of it but i seem to get the above error when i try to enter some manual text. code as follows:
protected CollectionRequest collReq; protected void Page_Load( object sender, EventArgs e ) { collReq = (CollectionRequest)LoadControl("~/CollectionRequest.ascx"); TextBox _txt_address = (TextBox)collReq.FindControl("txt_Address"); _txt_address.Text = "thisi is an address"; control has been referenced in source file <%@ Reference Control="~/CollectionRequest.ascx"%>
i am caling this code in my Approval.ascx.cs code. both the user controls are displayed together in the default.aspx page one above the other.
I need to create .net membership user instance for a database living in a different server than the one I'm coding in. What is the best way to do this?Should I do it though Sql Server stored procedure? or should I use a separate provider (therefore having 2) in my web.config?
I need to create this user without using the "create user wizard".
I have created on my local machine with targetframework 4 in visual studio a simple website using the default template (the one with css problem solved here http://stackoverflow.com/questions/3897781/google-maps-api-in-asp-net-masterpage-why-it-stays-blank)I uploaded it to my IIS 7 server which was first configured for .NET 2 so in web.config I deleted the line
so that it can run on .NET 2.Until then that was fine.Then I edited in ISS7 my website to use .NET 4. When testing the site again, I got this error:Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path.I hadn't told you that I didn't install any sql server yet so this message may be normal but why didn't I get it with .NET 2 ? Could I configure something in .NET 4 so that this error is ignored like on .NET 2 ?
I have implemented a custom ErrorController with NoAccess Action returning the View "~/Error/NoAccess" (not inside the Shared folder).
I have also modified the web.config file and add a custom error "<error statusCode="403" redirect="~/Error/NoAccess" />" node.
Each time i enter to an anauthorized page, i get redirected to the logon page (even though i am already logged on). I would to modify the default asp.net mvc authorization functionality and each time a user tries to enter a page that is not authorized to get an "NoAccess" page instead of redirecting to the login page.