C# - How To Handle NHibernate Sessions In WebForms Application
Jul 16, 2010
I see there are 2 possible scenarios as to the session handling:
Open one single ISession per request. Open it at request start and close it at request end.Open one ISession per conceptual "unit of work". Many sessions are created for a request.
The approach #1 is the one I'm doing now. I'm a little bit worried about it because, although it works, it's a little bit difficult to debug. For instance, I have an object not being saved (even though I ordered it to) and I'm having trouble debugging since there's a LOT of things happening during a complete request life-cycle.
The approach #2 seems to be the standard best-practice (not sure about ASP.NET) and I'm sure it's pretty easier to debug. The problem I see is about inter-session communication. For instance: My Page class holds a reference to the User, which is a persistent object. Many of the operations receive the user as parameter. As the user belongs to a different session, I can't pass it as a parameter.
I'm biased to #2, but I don't know if it's the best practice, nor how to deal with cross-session object.
View 4 Replies
Similar Messages:
Oct 15, 2010
I have scoured the web and have yet to find and example that matches my requirements.
What I have is an existing multi-tenant asp.net application where all users authenticate against a single SQL Server database. This database also contains several other settings type data that is used within the application. Each client after authentication, utilizes thier own SQL Server database for data storage, for isolation purposes. Essentially all of the client database are identical and reside on the same server, but reside on one or more servers as well.
The application is currently written in asp.net 2.5 framework and utilizes the Micrsoft Practices Enterprise Library for DAL. Wnd we are looking to migrate to 4.0 and implement NHibernate to replace the MPEL.
I have implemented a solution already using NHibernate and the 4.0 framework, so I am familar with the concepts. I found the resources for my current session manager here as a matter of fact. But that application only had a single database, so not much too it.
The implementation is essentially what you see here:
[URL]
The other solutions that I have seen multiple config entries and/or files to manage this, but that is not desireable, since we may add new clients frequently and all of the connection information is already maintained in the authentication database.
[code]....
View 1 Replies
Mar 30, 2010
My company took some old php application over. Due to our preference to ASP.net and to the lack of any documentation from the previous developer, we do not want to spend much resources on developing in PHP. For implementing new features, we will create an Asp.net application that has the same look to the user. We want to develop a kind of 'coexisting' web application. Therefore we must share sessions between an PHP and an Asp.net webapplication project, because there is a usermanagement involved with an existing MySQL database.
(e.g. link 'A' directs to the PHP website, and link 'B' directs to the asp.net application)
How can we share the session between and PHP and an asp.net application?
And does anyone have a hint for this 'coexisting' thing, that might be useful in development?
View 5 Replies
Mar 18, 2010
I have an application with different sections. Each section is accessed through a domain. Example:
[URL] I need to preserve the session when the user navigates from one to another URL. The application is the same in IIS. How to accomplish that?
View 5 Replies
Dec 10, 2010
I'm designing my first asp.net web app, using nHibernate as the data provider. i've read a lot about nhibernate in web applications using session-per-request pattern. my application will have a few pages which are 'monitors', meaning- they're updated automatically every few seconds to reflect recent changes to data. in that case, my thought is that opening a session for every request would not make much sense, since I know that an identical request is sure to follow in a few seconds. my thought is that session-per-conversation would make more sense for me, but I'm having trouble finding examples of implementations. I'd appreciate any good resources for how to implement session-per-conversation
View 2 Replies
Mar 22, 2010
We are programming a new web application framework (Second WAF). I was wondering if we should support cookieless sessions or not. Who use it and who needs it?
View 2 Replies
May 19, 2010
how to control camera through Asp.net sessions and Asp.net application programming architecture
View 2 Replies
Nov 25, 2010
We're currently deploying code to live pretty reguarly at the moment, but the down side is destroying user session data.
Is there a way of being able to recycle IIS without loosing session data, or is persisiting session state in SQL server or alike the only way?
View 2 Replies
Mar 11, 2010
I am about to start a new application and am excited about using asp.net mvc and nhibernate. However, the big "problem" is how I handle the user authentication stuff. What are some ways those used to using nhibernate and MVC solve this problem?
My thought is let asp.net do its own thing and I do my own thing database wise. Am curios if I should role my own using the provider model and nhibernate, if I can figure out how. Or is there a way to integrate current code that is in the mvc example into nhibernate?
View 3 Replies
Dec 30, 2010
A value needs to be passed from an asp.net application to another within the same domain. How we can do?
View 5 Replies
Jun 1, 2010
I tried to figure out NHibernate (a first) First went through chapter 23 in Asp.Net MVC in Action 2, and read some articles to get the drift.
Then I modified the sample in the above book to work with my own database and my own table. Finally got that working. (Started messing with this yesterday afternoon....it's 7:30 AM, so .... I'm tired...)
Then I worked this into my own project (the shared mvc template some of you might have looked at).
Now my application became completely unstable. Sometimes it work, but other times it bombs out where my controller factory (Castle) set the component lifestyles:
[Code]....
Each time with some LoaderException that read like {"Could not load file or assembly 'Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc"}
Man I fiddled all over the place, having xcopy copy dll's (see krok.web properties got a post build event) and many other things I that does not really make sense.
And from the darned instructions, having all your dll's in a folder which get copied out to the web project's bin folder and dont know what else.
Seriously...if someone can download this and have a look (better not if you dont know Castle Windsor and NHibernate)
View 3 Replies
Apr 9, 2010
Is there anyway to actually remove all the sessions once the user leaves the site/application or when he/she closes the browser?
View 11 Replies
Sep 10, 2010
We got a problem that Sessions got mixed up when open multiple tab in a single application. We could change the code that do not use session variable in a that level, but a tons of page need to be modified. We need to find a quick fix for this problem. Is any thing we can do in code level to prevent user open multiple tab in a single application? O any thing we can do to keep its own session for a single tab?
View 6 Replies
Mar 9, 2010
I know that ASP.NET MVC has error filter attribute to handle specified error type. However, this feature cannot catch any error that occurs when application start. Therefore, I need to add some code to "Application_Error" method for handling this error like the following code.
public void Application_Error(object sender, EventArgs e)
{// At this point we have information about the error
var ctx = HttpContext.Current;
var exception = ctx.Server.GetLastError();
[code]...
View 1 Replies
Sep 29, 2010
can you tell Will sessions kill when application error occurs which is in global.aspx ?
ex:
[code]....
View 1 Replies
Aug 24, 2010
We've inherited this ASP.NET website. We've already converted it to a web application for different reasons that doesn't matter right now.
But there are 2 folders with 2 .aspx pages inside that does some really ugly stuff (creates a new aspx file with its corresponding code behind and save it inside one of those folders).
So when the proyect was a simple website, that worked, because the created pages on runtime were compiled at request. This is not applicable to a web application.
We don't have time to re-code those ugly pages and do it as it should. So, is there a way to have those 2 pages (and the generated-at-runtime ones) excluded from the project and inside a website that is compiled at request?
View 1 Replies
Feb 23, 2010
Is there a way to write an small application that will run both as a windows forms application, and within an asp.net application?would some sort of widget or even something in silverlight do this?
View 3 Replies
Jun 18, 2010
I'm developing a Web tool in ASP.NET 2.0 with AJAX . Its working fine in Local Server. When i deployed it in Development Server and executing the Application , I got an error
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(),
response filters, HttpModules, or server trace is enabled.
Details: Error parsing near ' I didn't use any Response.Write in the Application. How can i solve this issue ? Any body knows the solution for this ?
View 2 Replies
Dec 2, 2010
i am working on a asp.net webforms app, and i have to create 'dynamic order lines'That is : you select a product and a quantity, and the amount is calculated.
To visualize: this is on one 'line', so forst product dropdown, next to it the quantity textbox and next to that the amount label.
Then you click 'add another product', and another 'line' is added with a product dropdown, quantity textbox and amount label.
So you can click add and add and add....
Now i was thinking how to implement that, and i came up with two choises:
'add html client side' and 'add user control server side'
The first looks more fancy of course, but i also have to create some server side code to generate the lines again, when the user says 'go' but after validation i have to warn the user for example the amount was over credit or the quantity was to high. Then i get the 'client side' added html, and i have to reproduce that in my code behind, am i right?
On the other hand (add user control server side), i have to create a new user control on 'and another product' postback, which might look easier in the beginning because it's all strong typed, and the client side (jquery / javascript) isn't?
And one more thing: there is a possibility (they are not sure yet) that this functionality is wrapped within a 'section', with an address box and call it an order.And then: the user can add that 'section' also multiple times, so he can create multiple orders in one page, so i have to create multiple sections for an order, and within that order have the possibility to add another product.It looks like it will be hard to do this client side, especially with generating id's?
View 2 Replies
May 21, 2010
can I include normal asp.net pages (webforms or mvc) in a Dynamic Data web application?
View 2 Replies
Jan 6, 2010
Recently I was working on displaying workflow diagram images in our web application. I managed to use the rehosted WF designer and create images on-the-fly on the server, but imagining how large the workflow diagrams can very quickly become, I wanted to give a better user experience by using some ajax control for displaying images that would support zoom & pan functionality.
I happened to come across the website of seadragon, which seems to be just an amazing piece of work that I could use. There is just one disadvantage - in order to use their library for generating deep zoom versions of images I have to use the file structure on a server. Because of the temporary nature of the images I am using (workflow diagrams with progress indicators), it is important to not only be able to create such images but also to get rid of them after some time.
Now the question is how can I best ensure that the temporary image files and the folder hierarchy can be created on a server (ASP.NET web app), and later cleaned up. I was thinking of using the cache functionality and by the expiration of the cache item delete the corresponding image folder hierarchy, or simply in the Application_Start and Application_End of Global.asax delete the content of the whole temporary folder, but I'm not really sure whether this is a good idea and whether there are some security restrictions or file-system-related troubles. What do you think ?
View 3 Replies
Jan 20, 2010
Almost all the applications I worked on involve some look-up values. For example, a lot of times a list of languages ( English, French, etc...) need to be displayed on the WebForm for user to choose.
The common data structure for such look up values include an integer Id and a string as name. Since these look-up values are used so frequently, and they are unlikely to be changed. Most of time, instead of grabbing them from database, I just define a global enum in C# like this
enum Language : int { English = 1, French = 2}
I've been handling look-up values like this for years now. I knew it may not be the best way to handle them. For example, every time a new language is added to the system, somebody needs to remember to update that enum.
View 3 Replies
Aug 10, 2010
I am trying to handle concurrency in my application. Basically if user A has a support ticket open which currently has a status of 'Active' and user 'B' opens the same ticket and closes it (changing its status to closed), I would expect a confict execepton to be thown when user 'A' tries to close the support ticket. For some reason this is not happening. I have checked that Update check is set to 'Always' in the dbml file. Here is an exerpt of my code. // Update 'Active' lead to 'Close'
[Code]....
View 2 Replies
May 20, 2010
Hopefully this is the right place for this question. I have done a fair amount of research and yet to find anything that matches what I want. What I'm envisioning is the following. Let me know if any of you know of a program that will do what I want. Also it must be web-based anom user -> fills out form -> email gets sent to admin saying xyz has filled out form abc with links to approve/disapprove request.
admin can also login and edit form and resent results to original submitter. Also once the admin approves/disapproves request the original submitter gets an approve/disapprove email.
and you can search by date submitted, specific project/form, status of request(submitted, approved, disapproved). all on where I could find this? I started to look into drupal with workflows and actions but it just doesn't flow right for this
View 1 Replies
Sep 26, 2010
I have used Quartz.Net for queuing and sending emails from my application. I don't know how each scheduled job responds to application instance stopping, pausing or shutting down. The IJob interface has no method that can notify a running job about these events.My question is how can I handle these cases when they occur so that the job can exit while leaving the application and the data in a stable state?
View 1 Replies