Do web applications keep getting completely rebuilt between requests? - asp.net

Given that HTTP is a stateless protocol, does IIS keep 'rebuilding' a requested web application for every user and every request?
Suppose a user arrives to a login page. IIS builds the web application and returns the login page to the client. The client enters his credentials and is then taken to the landing page of his account. Was the entire web application rebuilt just to get him from the login screen to the landing page?
I have been reviewing the literature on the asp.net web app life cycle but can't seem to find a clear answer on this.

ASP.Net applications are usually already compiled before they are deployed to your IIS server.
What happens is that IIS will load your application when the first http request is received. For other requests, they will only be served by IIS as the app is already loaded.
The fact that http is stateless does not have any correlation with how the app is manager by IIS. It only means that no state is maintained at the protocol level between 2 requests.

Related

How many App Domains are Created

I am going through how ASP.NET page is processed when the request is send from browser to Server. From many sources i came to know that during asp.net request processing Application Manager instance is created and the Application manager creates the application domain . The Application domain provides isolation layer with in the process. My Question here is for the same application if there are many requests coming up , will all the requests will be processed by same App Domain or it will create many App Domains for each request. How to calculate how much memory the Application Domain is using. Will the App Domains share the dlls if many App Domains are using the same references like (system.web, system)

Asp.Net page does not respond until cookies are deleted

We have deployed our Asp.Net webforms app on Azure platform, the app is being served by two web servers load balanced. Asp.Net session is managed by memcashed.
Generally app works fine but randomly it gets hanged, if we try to reload the app, request is not getting processed by the browser, no error at all, continuous loading.
Only way to make the app work again is by DELETING COOKIES for this specific app from the browser.
This happens in Firefox as well as in Chrome so does not seem to be a browser specific issue.
Cookies in particular is not that heavy, there are only 3 cookies, 1 being asp.net session cookie and two other for persisting user credentials.
App is about real-time chat service so it polls web server at each 4 seconds.
We have already referred one similar issue but that does not help.
If it happens randomly it looks like it caused by load balanced configuration. From my experience the most common reason for issues with load balanced farm - different machineKey values.
Try to check you have the same machineKey value in web.config for both servers.

Intercept requests for iisnode with HttpModule

I have a nodejs app running using iisnode in a sub directory for a .net application (umbraco actually).
The .net application is using forms authentication and I want to secure the iisnode application using the same mechanism as the .net application.
I've tried registering modules with the iisnode app but it doesn't even seem to fire the event handlers. Is it possible to do this?
It seems that creating an HttpModule to intercept nodejs requests is impossible. However, I did find a way to get the authentication information I was after.
I created some middleware in my nodejs (expressjs) app that picks up the headers from the request (including the cookies) and make a request to a specially created url on the asp.net application using those same headers.
This url simply returns the user info for the user specified in the cookie (if the cookie is present). If I get back some information then I know the user is logged in. No information means they are not logged in and I redirect to the umbraco login page.

Redirect to Web Service WebMethod from ASP.NET Website

I have a website created with ASP.NET and a web service, both using FormsAuthentication (which validates the user's credentials against Active Directory - LDAP).
When I call an action method of this web service for the first time I am redirected to the site's web page that actually logs the users into the system. When I'm logged in I will be redirected to the web service (ReturnUrl), but I'm guessing something gets lost in the way, because I'm getting an InvalidOperationException (in the client), containing the .asmx definition.
This happens on the first call only, the next calls work fine (since I'm going to the right place).
What am I missing here?
How should I redirect from the web site to the web service? Can this be done?
Thanks in advance.
Your web service call is doing a Post, then redirecting via a Get request after authentication. The default response from an ASMX is the .wsdl definition. You can't do web service authentication like this programmatically.
If you are using Active Directory, why not use Windows Authentication and suppress the login?

Passing existing cookie to Web service

HI have the following scenario:
1) i'm authenticated against some aSP.NET web site and my session time out expires in 24 hours.
2) after several time I would like to run query against asp.net Web Service located on the site using existing authentication.
What should I add to cookie Container? I how do sent existing cookie to Web service?
Thank you in Advance.
Danny.
A web service call is just an http call so it will come under the existing authentication.
I am assuming here that you are issuing this from the browser?
If not - e.g. if you are doing it from a console application, then you will have to interact with the site as if you were a user. Some more details are her http://www.ksingla.net/2006/08/sample_forms_authentication_test_in_csharp/
Basically you need to issue a post to login to the login page - track all of the cookies etc - and then start issuing your WS calls with those cookies.
Another option is here http://en.gli.sh/Blog/post/NET-Interoperability-Between-Smart-Client-and-Internet-Explorer-Using-Cookie-based-Authentication.aspx which is reading the correct cookie info from the windows machine you are on - relies on you being logged into the website and also trusted to be able to get to that file.
Alternatively you can look into implementing WSE or WCF solution.

Resources