• Subscribe to this RSS feed
  • Receive updates as soon as they are posted.

ASP.Net Category

If you have tried to set the width of a control (like a table) in code, you probably have received an error since it’s expecting an integer/unit. However, it’s very possible to set the width as a percentage, and probably a little easier than you would think.

Sometimes it becomes necessary to create a solution and either you don’t have a solution file for your project, or your solutiion file has been renamed or has become corrupted. At that point, it’s not as straight forward as one would like in order to get it done. However, it’s not a laborious task at [...]

September 15 , 2011 | | In: ASP.Net, C#, VB.Net

Function doesn’t return a value on all code paths

When you get a warning in your ASP.Net code, it means just what it says. The full error is usually: “Function (YourFunction) doesn’t return a value on all code paths. A null reference exception could occur at run time when the result is used.”

You probably know that, in order to retrieve the currently logged in user in ASP.Net, you would use this code snippet: System.Web.HttpContext.Current.User.Identity.Name() This returns the current user in the DOMAIN\USER format. But sometimes, all you want is the user name itself, without the Domain and slash. Here’s a function you can use to do this:

First – don’t panic – I realize you have no information when you get this error and you have no troubleshooting direction at all, but don’t panic. Help is on the way.

May 6 , 2011 | | In: ASP.Net, ASP.Net Tutorials

ASP.NET Page Level Impersonation

Sometimes, global Impersonation in the website may not be the correct solution for you. However, it is possible to provide Impersonation at the page level. To do this, you can provide Impersonation for the page, using the current logged in identity of the person viewing the page. One specific need in which this might be [...]

Knowing the environment variables in your program can sometimes be a very important aspect of your application. It’s very easy to get a list of and to use any one of the environment variables however you need it.

March 23 , 2011 | | In: ASP.Net, ASP.Net Tips, C#, VB.Net, WinForms Tips

Using the Replace function

Most people know that, with a string in ASP.net or WinForms development, you can use the replace function to replace certain characters within a string with others. And, you probably know that you can even remove characters alltogether, using the replace function.

I got this error and it showed that it was in the web.config file of my website. It took me a long time to actually realize that it was NOT THE web.config, but in a folder that Visual Studio did not show as being in the project – – a ‘vti’ folder. The text of [...]

January 19 , 2011 | | In: ASP.Net, ASP.Net Tips, Uncategorized

Miscellaneous SQLDataSource Facts

I was just going over a few notes, when I had a quick little project in which I needed a SQLDataSource control, and I thought I’d present what I found here.

-->