Kent J. Chen's WebLog

a personal journal by an addictive geek

ASP.net

[ASP.net] A free HTML Editor Control that works with AJAX

Posted in ASP.net on July 15th, 2010 by Kent

FreeTextBox used to be my favorite and I use it without second thought every time when I need it but not anymore because it doesn’t play nicely once you place it inside the <update> panel for Ajax. Without doing it, I can’t use the modern modal popup for data update form.

Luckily, ASP.net Ajax control toolkit already includes a HTMLEditor for you to use.  However, from the testing I have done, it doesn’t seem to be working properly in Chrome. Besides that, its lack of paragraph style format also made me not to use it at the…

[ASP.net] looking for a better Ajax File Upload control

Posted in ASP.net on June 7th, 2010 by Kent

I had a small web app that requires to have a component that can easily upload the file to the website. I could use the standard File Upload control that comes with .Net framework but because it requires a postback I couldn’t use it injunction with the Ajax stuff I use on the same website.

I could also use the AsyncFileUpload control from the latest ASP.net Ajax Control Toolkit but because it doesn’t have a progress bar indicating the upload progress it still lacks of in usability at some point.

I could also use

How to add <br /> into text from multiline of textbox

Posted in ASP.net on May 14th, 2010 by Kent

So here I go again having to face the challenge saving the text from a multiline textbox in ASP.net without missing the line break. Last time when I did it, I only made it work in Internet Explorer so this time I am trying something different and easier.

I could throw in some free add-ons like FreeTextBox that would make things actually fairly easy but since all I need this time is just replacing the line breaks with HTML tag <br /> so the text can be rendered properly in email and web page.

It’s actually…

Fixing HTTP Error 500.19 when setting up IIS in Windows 7

Posted in ASP.net, Information Technology on January 19th, 2010 by Kent

I was preparing my development environment on my Windows 7 yesterday. I loaded Visual Studio 2008, enabled IIS, and pointed it to my apps directory. All look good until I converted one app I coded before to application and tested it through my web browser.

Zoom it out to see the detail errors if you can’t read it clearly.

I then also tested a fresh built web app with default settings. It still happened the same. The link at bottom of the page points to a Microsoft KB that also didn’t seem to help.

Without…

Pulling the user info from Active Directory in ASP.net app in C#

Posted in ASP.net on September 22nd, 2009 by Kent

I have a small ASP.net web application that requires to redirect users to different page based on the department they belong to. So basically, the app needs to contact the Active Directory and pull the user info from it. In order to do so,

First, add the System.DirectoryServices reference to my app project in Visual Studio, which adds a single line in Web.config file in <compilation> section telling the web server to reference the Directory Services library from the .Net platform.

Second, add the name space by putting the line “using System.DirectoryServices” at the top part of the…

A column named “comments” already belongs to this DataTable

Posted in ASP.net, Tips & Tricks on July 31st, 2009 by Kent

I was trying to add a RSS feed in my sidebar on this blog the other day. And because this blog is powered by ASP.net I have to write a control page that pulls the feed in XML and render them to the page. I thought it was a simple task that only needs a few lines of code to make it work, until I get this message.

After googling a bit, this post seems to explain the reason why it happens when simply using ReadXml doesn’t work.

The problem is this:

An RSS

UpdateProgress control disappeared before the Page gets updated on ASP.net Web App

Posted in ASP.net, Tips & Tricks on May 23rd, 2009 by Kent

I have a small web application written in ASP.net 2.0 (works on 3.5 as well) with Ajax enabled. What it does is to search information on a online database and downloads as PDF.  I use <asp:UpdatePanel></asp:UpdatePanel> to wrap up the web form content, and use <asp:UpdateProgress> to show a modal popup type of progress icon during the actual download.

It works great except when the PDF is bigger than a few megabyte this nice Ajax type of progress modal disappears without any results returning to the content in the UpdatePanel. I scratched my head many times without any luck finding it…

Sending Authenticated Email in ASP.net 3.5

Posted in ASP.net, Tips & Tricks on May 20th, 2009 by Kent

The info from my two previous posts, here and here about the same topic wasn’t quite complete and doesn’t seem to work in ASP.net 3.5. So here is another update on this topic, in cause someone is running into the same issue as I had.

So, what is the authenticated email?

It’s a method used in Microsoft Exchange mail server that prevents an account from receiving emails from outside the network, typically for spam emails. It’s especially useful when used in distribution groups that are only used internally. To enable it, you can simply go to…

Sending Authenticated Email in ASP.Net 2.0 – update

Posted in ASP.net, Tips & Tricks on May 14th, 2008 by Kent

Apparently, settings described in my previous post isn’t good enough to make it work, it wasn’t quite right indeed. There are a lot more stuff needed to be figured out.  Google isn’t much helpful in this case, which is a little bit surprise, maybe this case is just so rare.

To recap what I need, I have a simple impersonate set to true web form that collects information and email them into a distribution group that receives email from Authenticated User Only in Exchange.  It might be easy when impersonate is set to false because then you can simply set…

Send Authenticated Email in ASP.Net 2.0

Posted in ASP.net, Tips & Tricks on May 4th, 2008 by Kent

To send emails from web form written in ASP.Net 2.0 to an email address that only receives emails from authenticated users, you need to set defaultCredentials=”true” in web.config file with other SMTP settings, see below, or the email sent from the form will just go missing without leaving any trace.  For example:

<system.net>
    <mailSettings>
        <smtp deliveryMethod=”Network”>
            <network host=”mailserver” port=”25″ defaultCredentials=”true” />
        </smtp>
    </mailSettings>
</system.net>

Besides, you might also need to set up security authentication impersonate to true as well in web.config file in order to pass the proper authenticated credential to the mail server.

<authentication mode=”Windows” />
<identity impersonate=”true” />
<authorization>
  <deny…