ASP.Net Session is lost - asp.net

We have the following web server and ASP.Net application specs:
Windows 2012 R2
IIS 8.5
ASP.Net Application using .Net 4.0
Classic managed pipeline
InProc session "UseCookies"
We have a problem when a successful login redirect to inner page which check the session keys to proceed, at that certain point the session keys are clear, where as I checked chrome developer tools I found that the asp.net cookie has no value.
I referred to other threads with the same problem but nothing helped, where all solutions been provided was to play with code where actually the same code and setup above is running fine on other servers, so my suspect is may be windows, .Net or IIS settings, where I have tested it locally on the same server using "http://localhost" and I disabled any tools like (firewall, antivirus, etc...) but it was useless.
Is there any configuration I should check?

Related

Why is restarting client IE changing the username logged in IIS?

I have an ASP.NET WebForms application. Some of my users reported that they see their username in "domain\username" format. When they close their IE and open it up back, username is shown as "username". Application shows "username" mostly. However, it shows "domain\username" every once in a while (I couldn't find the pattern).
What is the reason of this behavior?
Environment:
Windows Server 2008 R2, IIS 7
.NET Framework 4.5.2
Anonymous and Forms authentications enabled. Others disabled
Application pool idendity: “ApplicationPoolIdentity”
In application pool settings, “Enable 32-Bit Applications” is “True”
In application pool settings, “Managed Pipeline Mode” is “Integrated”
Internet Explorer 11 is used in client
Variable I use to get usernames: User.Identity.Name
SiteMinder was creating the issue. Once it's installed in your web server, it may change your application's cookies even though your application is not protected by SiteMinder.

Why do my LDAP calls occasionally fail with these messages?

I am developing an intranet ASP.NET web application that's configured to use Integrated Windows Authentication. My web app needs to check user entitlements using LDAP to get user memberships, etc.
The issue I noticed today is that, when I run my web app using IIS, sometimes the LDAP calls fail with strange errors, such as "Unable to contact the server..." ... or "...that domain doesn't exist..." (something along those lines, anyway). However, if I run my web app using Cassini, I don't get those errors.
If IIS is the issue, why would it fail some times and other times not? What does Cassini do different that IIS is not doing?
I'm using IIS 5.1 / Windows XP / Visual Studio 2008
Why is this happening, and how can I fix it?
Probably something to do with the fact that when you're running Cassini, it's your domain account that's querying the LDAP. It is strange that it would work in IIS sometimes though, and not others. Is the server registered on the network? What system account is IIS running under?
#James Johnson: I figured it out thanks to your comment, which got me thinking about my domain account... Finally, I found this post which points out that in order to connect to LDAP one needs to set Impersonation=True in web.config. It was working intermittently this morning, I think, because I was using Firefox instead of IE, which required me to enter my domain username and password.
The other strange thing was that my app worked fine in our development and stage environments even though my web.config is the same for all of them. I suppose the guys in the hosting group have this set at the machine.config level.

Can't debug ASP.NET application stored in IIS

I have a question regarding IIS (version 7.5) and ASP.NET (.NET Framework 4) . I am trying to debug ASP.NET web application which is stored on IIS. Now, I have done this in past and everytime it worked perfectly.
But now when I try to do same, **Visual Studio 2010** always gives me error, **"unable to start debugging on the web server. the iis worker process for the launched URL is not currently running" ...** even the application I had created in past (& stored in IIS) can't debug using Visual Studio. But all applications (new & old) can be accessed if I type their path in Browser, and they work fine too.
I did search on internet about my problem and I found many posts, but almost every post talks about activating **Windows Authentication** in IIS for the application in question. But, I am using Windows 7 home premium and the IIS shipped with this version doesn't support option for Windows Authentication. Also, if this is the only reason then why my old applications were working just fine till now without this Authentication method?? I found MSDN help about this error but it is not much helpful to me. I also checked APPLICATION POOL selection in IIS and my Application (both are using V.4.XX.XXX)... I have also checked **BINDING** , which is *:80 to Default Website, that means all requests to port 80 will be directed to default website (where my all applications reside)
As a side note, I have SharePoint Server 2010 installed. Which has its own website (which I have disabled while debugging) ...
I think there is something is changed in my IIS configuration, but I cant figure out what it is. And I am sure that it has something to do with SharePoint installation (may be because of more than one website on IIS for same port ??). Because I am using IIS for first time after installing SharePoint and I am having this error.
I will really appreciate if any one has answer ...
Thanks,
Jack
UPDATE: As I suspected ... having more than one site in IIS was root cause of trouble, Once I uninstalled Sharepoint Server 2010 and its web sites from IIS, my Visual Studio 2010 debugger was able to "Auto-Attach" w3wp.exe process while debugging any application ... ( I really don't see any reason that even after disabling all other websites why still it was giving me error at first place ?? )
I know its not a solution, because I have to remove Sharepoint Server ... but at present its more important for me to work on that application then Sharepoint Server.
But I am still open for any suggestions which might help me to run both together ....
Thanks,
Jack
Check the Bug fix for this issue in the Microsoft's Connect site.
.
Is it with .NET 3.5 in Visual Studio 2010 , if yes , then check http://www.ginktage.com/2010/08/fix-for-visual-studio-2010-hangs-when-debugging-asp-net-3-5-web-application/ for information

ASP.NET Session State Server on IIS 7.5 and Windows 2008 - Not Working

We are moving an application from a hosting environment using IIS 6.0 and ASP.NET session state server (both on Windows 2003) to IIS 7.5 and ASP.NET session state server (on 2008 R2).
We are having a problem, in the new environment, where if a user gets moved across servers in the farm, their session state is lost. We had this exact problem in the old environment, and fixed the problem using the information in the following article
http://support.microsoft.com/kb/325056
However, we are not able to check the part about the application path in IIS 7.5.
Does anyone know how to troubleshoot this problem in IIS 7.5?
In IIS Management Studio, click the Sites tab, and make sure the ID matches the ID on the other web servers. If you need to change it, click the site in the list,, then click Advanced Settings. You can change the ID of the web site in that dialog.
Check out the following link it will help with general configuration:
http://forums.iis.net/t/1202777.aspx?Sharing+ASP+NET+State+Service+sessions+between+IIS7+5+and+8+0+doesn+t+work
Although this link is about IIS 7.5 vs IIS 8, what you need to know is .NET 4.0 and .NET 4.5 are not compatible, and that's key.
I had 2 IIS 7.5 servers in a web farm that suddenly stopped sharing session state correctly even though everything appeared to be configured correctly. Come to find out, one of the boxes had been updated to .NET 4.5 with windows update. Updating the second box to .NET 4.5 fixed things. Here is a link on how to tell what version of .NET you servers are running.
http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx

Why is IIS not serving aspx pages?

I'm deploying an ASP.NET application to Windows Server 2003 under IIS
IIS is serving html pages fine but I get a page not found when I try and serve IIS pages
You may need to "register" IIS for ASP.NET applications. As an administrator, run the command "%systemroot%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i". In addition, you may need to convert your web site to an application through the IIS management console.
By default, IIS has ASP support disabled in IIS6.
A server running a member of the Microsoft® Windows® Server 2003 family supports application server functionality, with Microsoft ASP.NET as an option that you can enable when configuring the application server role. To deploy ASP.NET Web applications to a production server, you must be sure to enable the ASP.NET and Internet Information Services (IIS) roles on the production server before you distribute the application.
See here for instructions to enable it:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/9fc367dd-5830-4ba3-a3c9-f84aa08edffa.mspx?mfr=true
Other possible reason could be Web Service Extensions, where ASP.NET version could have been disabled. My other post here explains steps to solve this.
Make sure the right .NET framework is installed properly
Make sure the ASP.NET extension is enabled
Under website properties, ASP.NET tab, make sure the right version is set.
After having this same issue and trying all of the above without any luck. We reinstalled SP2 for Windows 2003 and this resolved our issue. I too have seen this problem resolved a few times with the other answers. Most of the time just reinstalling .Net 2.0 resolves the issue but not this time.
For future reference, this could also be the issue:
IIS on a Windows Server 64-bit can only to run in either 32 or 64 bit mode.
In short you need to:
1) run adsutil.vbs to enable 32 bit asp.net apps on win 64
2) re-register IIS calling aspnet_regiis.exe
3) re-open IIS Manager, go into Web service extension list and ensure ASP.Net version {2/4.xxx} (32-bit) is set to Allowed
(You might need to do Steps 2 and 3 for both Framework 2.0 and 4.0 if you want to run asp.net apps on both versions)
Full details are in the following link: http://support.microsoft.com/kb/894435
Another future reference in case this is helpful to anyone who used a similar path to mine.
My back end for the ASP.NET app was MySql not Sql Server, which for me meant having a mysql connector, the reason my IIS was not serving the .aspx file is because on my development environment I was using a different version of the MySql connector than the one installed on my production environment, I updated the MySql connector on the production server to match the version Im using on the development environment and it worked great.

Resources