Got a question? Get an answer here

So I tend to describe a lot of issues here, but we had some really great conversation in our blog chat.  So I thought I would ask for questions from everyone.  Feel free to ask anything you like.  If it is a simple, quick answer, I’ll answer here in this blog posting.  If it is more complex, I’ll create a posting just for your question.

So ask as many as you want, the harder, the better.  But please keep it to IIS, .NET or ASP.NET as I am not an expert in all areas.

If you have an additional answer to a question, feel free to post that as well.

Question 1 – submitted by: Eber Irigoyen

Is it possible to find out if a specific session id is still alive?

Answer

While it is possible to do, it would require some extra work.  For instance, you could create your own log file to write to or just write to the event log in the Session_Start and Session_End events.  But with default settings, you can't tell if a session is still alive.

Follow-up question:

what about connecting a debugger to the process?

Is it possible to find out if a specific session id is still alive? (without making any code changes)

Answer

So you can get that information out, but the best way is to just look at the IIS logs.  You can see the session id’s there and see the time and compare it to your session timeout setting.  In a dump, it is rather difficult to pull out the session id’s.

Question 2 - submitted by: Vear

I've setup a Windows Server 2008 with IIS 7. I want to make sure that I can run Ajax and Futures, .Net 3.5 and silverlight. I'm not sure which version of what I should load. Should I be loading SDK's?.

Answer

Windows Server 2008 with IIS 7 gives you the best setup to run all the latest things.  You are all set for running all of these things.  You just have to then install them on top of IIS.  You can get the install links at https://www.asp.net/downloads/

Question 3 - submitted by: Sean Patterson

I've heard the Enterprise Library for .NET finally did a similar library, but I haven't had time to check it out. Have you had any similar experiences with Log4Net, Enterprise Logging, or any other tools for debugging your web apps?

Answer

There are a bunch of tools you can use for various types of troubleshooting.  The Enterprise Library for .NET is a very good tool that you can use.  But with some of the additions to .NET 2.0 SP1, you don't need it for just looking at exceptions as they are logged to the Event Log by default.  Depending on how deep you want to go, you can look at capturing dumps or using a profiler.  You can also use ASP.NET Tracing.  It really depends on what you are trying to deal with.

Question 4 – submitted by: Doug

I used the template for a personal site and the site works as expected in the development and when I copy the files to the server it displays as it should. But when I login on the site, it seems that the database that stores the Login names and passwords is not loading into SQL. I would really like to know what could be wrong on the server end.

Answer

Most likely what happened was the database you got with the personal site isn’t being moved to the server.  You need to check your database connection string and see where it is trying to connect to.  If it is trying to connect to the local SQL Server, you will need to move that database to the production machine also.

Question 5 – submitted by: chittibabu

Please elaborate about architectures. 3 tier, 2 tier and n tier

Answer

Tiers refers to the number of machines that are used to serve the site.  For example, if you have a web server and another machine that holds your database, you are using a 2 tier architecture (one tier for the web server and one for the database).  If you separate your site where the web server calls a business application layer and that calls the database, you are then using a 3- tier architecture.  You can read more of an intro to these things on Multitier architecture

Question 6 – submitted by: Hazel

Is ASP.NET a version of .NET? Or are the terms .NET and ASP.NET interchangeable?

Answer

ASP.NET is a web component to .NET.  It is an addition to the base CLR.  So you have the .NET Framework which any application can use, ASP.NET is a web application that sits on top of .NET itself.

Question 7 – submitted by: Sherry

How do you include classes that were designed for a windows application into a web application?

Answer

Windows applications can be included as long as they are just classes and don't do anything visually. It is also a good idea to stay away from System.Drawing on the web. You should be able to just add them to a project in Visual Studio and use them.

Question 8 – submitted by: Sherry

Also, if you are working with databases and you choose Access instead of SQLServer, what do you need to change in the code?

Answer

For access, you just need to change the connection string. Nothing else needs to be changed, depending on what client you are using. The SqlClient is only for SQL Server.

Question 9 – submitted by: Pradeep

For a single click on a collapsible panel control in Ajax it should expand, but its happening for the second click, is there any solution for that? Do I need to set any of the property there?

Answer

There shouldn't be a property to set for that. Are you on the release version? Maybe it is a problem with the beta. Also, you could try checking out the video at:

https://www.asp.net/learn/ajax-videos/video-89.aspx

It may be inside another object that is affecting that also.

Question 10 – submitted by: Fanweixiao

Too many exceptions could makes CPU high? why? because of the GC?

Answer

Yes exactly. It is expensive to create them, gathering the callstacks and all the data, and it is also CPU expensive as they take up a lot of room and then the GC has to clean them up.

Question 11 – submitted by: Fanweixiao

Virtual bytes is larger than private bytes, means there are too much fragmentation? If it is, where are they from? Does it makes high CPU?

Answer

It is hard to tell without getting a dump. When .NET grows, we will reserve an entire segment and, on 64-bit for example, this can be a large allocation. So it could just be that. For example, if you have multiple processors, we will allocate one segment for each processor at start-up which can cause a large difference between private and virtual.

Question 12 – submitted by: Chrnico

I have an AJAX-intensive project that has recently been upgraded to the 3.5 framework (the Ajax control toolkit has been updated as well). Everything is functioning correctly but I now have mysterious postback flickers occurring in my ModalPanels and TabContainers. Any idea if this is a known bug?

Answer

Not that I’m aware of.  I looked and didn’t find anything with a quick search either.

Question 13 – submitted by: P

I am looking for asp.net feature, whenever a new record is inserted in a database table, I have to get an alert in the application. like ticker, like gmail chat. but I should not have plug-ins or client-side software to install.

I will be happy if you have some way in asp.net AJAX or some other ways. please let me know if you have written any article on this, and please do share the link where I can get your guidelines.

Answer

There isn’t any samples that I can find that do this, but you could use AJAX to do this.  Just setup a timer with an interval that is good for you and have it check the database for updates.  It can then update the UI accordingly.

Question 14 – submitted by: Pat

I have a question about IIS.  I'm trying to start a project in VB ASP.NET web form.  I have downloaded the IIS manager 7.0 and I'm running WinXP with the updates.  When I try to start the new project I can't put in a URL of my PC.  Is IIS not running?  I'm not sure how to check as I'm new to ISS and ASP.NET.

Answer

You can try running inetmgr from the run command and you can see in the MMC if it is running.  You can also try browsing to https://localhost and see if that works.

Question 15 – submitted by: Jim

The URL is an html file that uses an iframe tag to another server at mail2.eweb-tracker.com. All works just IE when I put my cursor in the UI I get a dialog error: access denied. I have look for help but all I get is IE does not allow cross domains. But Firefox works great. What can I do.

Answer

If you are using AJAX, you can do the solution here or here.

Question 16 – submitted by: Baka

What's the difference between WCF Vs ASMX (web serivice) if any? Also, some test data or comparisons would be nice.

Answer

Great question.  You can find the differences here.

Question 17 – submitted by: Muhanned

how can I convert the html base web pages into .aspx file I have problem to convert 100 .html pages into .aspx

Answer

The easiest way to just convert them is to do a find and replace and just rename them that way.

Question 18 – submitted by: Basheer

Please try to introduce a complete web  site application from plan to deploy as a guided in pdf format.

Answer

This isn’t exactly what you are looking for, but there is an amazing sample along with lots of data around it at https://www.dinnernow.net

Question 19 – submitted by: Rohit

hi can one please tell me that, I have one single web page made in vs2008 with 2 dropdown, with their autopostback property=true and each has two items in it. Now problem is when I access that site from remote machine through url after every 10 server trip it gives error, page does not render completely. weird it may sound but its true, if any one knows the reason please help

Answer

You would have to give more.  What is the error it gives?

Question 20 – submitted by: Pradeep

I want to create a User control called "PageNavigation" that contains Page Numbers (linkbuttons) and next and previous buttons. 

The problem I am facing is that the click event of these linkbuttons inside the user controls are fired after the events on the container in which this user control is used.

I want the new page number in the container so that I can fetch the records from the DB based on the new page number. But the new page number is generated only in the user control which cannot be passed to the parent page.

I tried to fix this problem in the page render event control, but it is causing problems with other functionality.

Do you have any idea how we can implement this?

Answer

You should be able to disable the bubbling of events up.  Check the Internet for disabling event bubbling.

Question 21 – submitted by: Venkata

I am looking for some guidelines, to make configuration changes to machine.config file on production server to boost the asp.net 2.0 application performance. While I can find lot of topics on Internet but none of them are specific to .Net 2.0. You help is highly appreciated.

Answer

Most of the performance gains are already implemented in 2.0 by default.  The only other performance gains you can get by following the steps outlined here and determining what is best in your situation.  You can also follow some of the blog entries I have to help narrow down what is happening.  You can also call Microsoft and have us help if you need it.

Question 22 – submitted by: Pedro

How can I use !savemodule to dump a dynamic assembly? I know you've talked about this on the chat, but I didn't know your blog back then and I can't seem to find any transcript (and "savemodule dynamic assembly" surprisingly doesn't get me anything in google but your blog!)

Also, are dumped assemblies well-formed executables? I ask this because I'm getting a "couldn't find runtime version" (or something of the sorts; it's in Portuguese and has been badly translated) when I try to run it.

Answer

So !savemodule will write out the assembly and it will be a well-formed file.  The way to look at the file is to use a reflector, such as Reflector for .NET

Question 23 – submitted by: Crprajan

I have developed a data entry page in my ap.net application. I have a textbox where i need to enter an emailid.(e.g crp@gmail.com). Besides the textbox i have one button control. When i click the button control after entering the emailid it should search for the userid in the usertable and if it is there it should alert the user with "The user already exist. Pls give another emailid".

How to achieve this? Can anybody pls help me out?

Answer

You should be able to use a CustomValidator and just check for a good email address and then update accordingly.

Question 24 – submitted by: Adam

I was wondering if there was a way to allow developers read-only access to remotely view, via IIS 6 Manager, how a site is configured?

Developers have read-only access to various hard drives, event logs and service lists to aid diagnostics of live systems but the bit that eludes us is IIS configuration.

The only solutions I've come across are; 1. export the metabase and restore on another machine 2. write a web app that exposes the state of IIS (not sure where to start here, WMI?)

Any hints?

Answer

The easiest way is to upgrade to IIS7. With Server 2008 you can do just that and even let them just have access to some parts of the console. Otherwise, writing your own using the IIS API's would be your best bet.

Question 25 – submitted by: Raji

I have a problem, when I use a master page & try to add a tree view links in the left side of the master page. but the content of the links are getting from dB . I need to know how this is possible in using Ajax update panel & tree view.

Answer

You should be able to do this exactly like you would on a normal page, using the update panel inside the master page.  Just don’t put it in a ContentPlaceHolder section so it is always on the pages.

Question 26 – submitted by: Francois

I don't know if that fits in IIS/.NET/ASP.NET, since this is a wider scope question, so feel free to reject it:

I've been wondering for a long time: the guidance's from Microsoft on how to do web apps (without MVC) in ASP.NET have come from the WCSF, using the MVP pattern and, among other things, the Object Container Datasource, which is great, but not part of stock ASP.NET

This is all great and nice, but what would you be your suggestion on a good pattern to make clean, well separated and easy to maintain enterprise level ASP.NET application using only the stock controls and libraries? Maybe a way to use the stock Object Datasource while still using MVP would be nice...

Answer

I’d suggest looking at the ASP.NET Quickstarts as they provide a great way to create things using the stock objects.

Question 27 – submitted by: Miguel

I read somewhere a few weeks back that you guys are working on adding VBScript/Classic ASP intellisense back into Visual Studio 2008. Do you know if this has been released yet? Is it still being worked on?

Answer

What I can tell you can be found here.  According to that, the suggested advice is to keep 2005 installed to edit VB Script.  They also said there that it will be supported in the next roll-up patch/Service Pack.

kick it on DotNetKicks.com