Showing posts with label ASP.NET website. Show all posts
Showing posts with label ASP.NET website. Show all posts

Monday, April 02, 2012

Part 1: Create a simple custom image browser for CKEditor using .NET

3 comments
For one of my websites, I was using the rich-text editor, CKEditor, to handle grab text from the user for articles and whatnot. The problem came, though, when I realized that the new CKEditor (previously, FCKEditor) did not have a file/image browser included with it. Without one, it makes embedding images in text using the editor a pain. Here's how to make a quick, simple image browser in C#/.NET and integrate it with CKEditor. (I'll show how I did a similar browser using PHP in Part 2, which I'll add later.) Here's a screenshot of the simple image browser:


Problem: An image browser was needed for CKEditor.

Friday, March 30, 2012

Error: Cannot have multiple items selected in a DropDownList

0 comments
Not too long ago, I created an ASP.NET website using Oracle (this is the same website as in an earlier post). On one of the administration pages, the item selected in some drop-down lists changed dynamically if items were deleted, but I was hit with the following error: Cannot have multiple items selected in a DropDownList. I was using ddlMyList.SelectedValue = someValue to change the selected item, but that wasn't working in this case. Here's how to fix this.

Problem: Website throws the error "Cannot have multiple items selected in a DropDownList" when trying to programmatically change the selected item using ddlMyList.SelectedValue = someValue.

Sunday, March 18, 2012

Redirect using your web.config file

0 comments
When I built a website for one of my course assignments, I initially put it in a subfolder on my server (because I was having some trouble with creating a subdomain at the time). Later, when the problems with the subdomains were fixed, I wanted my old location to redirect to the new location I had just created. If you are using a Windows server, you can do this with your web.config file.  (Apache servers would use a .htaccess file.)

Problem: Need to redirect old website to the new website.

Impact: Users will see the old page or, worse, will get fed up with having to manually go to another website. This will also impact search engine rankings.

Solution:
For this redirection, you will need to edit the web.config file in your old location because you want anyone browsing to the old location to go to the new one. Within your <configuration> tags, you'll need the <system.webServer> tags. Note that this is not the <system.web> tag. If you don't have this tag already in your web.config file, just put it in.

Now you'll need to type in something like the lines below:

<system.webServer>
   <httpRedirect enabled="true" destination="your_new_url" httpResponseStatus="Permanent" />
</system.webServer>

Notice that the httpResponseStatus is "Permanent" meaning that this redirection is permanent and that the URL given is the new URL. So now, when you go to your old URL, you will automatically be redirected to your new URL, which you specified in as the destination value above.

Saturday, March 10, 2012

Error: System.Data.OracleClient requires Oracle client software version 8.1.7 or greater

0 comments
Recently, I had an assignment to create a custom CMS for an ASP.NET website (for my web development program). Now, everything worked fine on my development machine, on which I had Oracle client installed, but when I uploaded the website to my server, I got the yellow screen of death with the error below. Ideally, I'd be able to install the client, but that was not possible in my case. The key was to somehow set up the website to connect to Oracle without installing a client.

Problem: Website throws error "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater" on live/production server. In my case, my hosting server did not allow me to install Oracle client, so what to do?