Upload Multiple Files With jQuery "Uploadify"

12. September 2010 11:00

API ASP.NET Jquery 

I have found many web developers seeking for help to upload a file in AJAX style, I am not a web developer but among the list of people who used to search the web for some control, way or a workaround to do this. I found a .NET control to do this, but like all good controls....it wasn't free. But the control worth it.

But now we have an excellent open source plugin called Uploadify. I have been using it for sometime and thought I should now blog and spread a word about it. To implement in your ASP.NET project is simple. Download the latest version of Uploadify from its official site here.

Take a look at the downloaded files. Actually, I need NOT to explain it again to you because the download itself has a PDF file which makes it really simple to understand the working and usage of the plugin. If you need to take a look how this plug-in works, then the  best place to look at the demo page at the uploadify page here.

I also compiled a small apllication with ASP.NET to see it in action with ASP.NET

NOTE: The code below I have uploaded is not written by me, I have just compiled a bunch of files under one hood to get it working.

Download: JqueryUploadify.zip (229.05 kb)

Currently rated 4.0 by 2 people

Add OpenID Login Support In Your ASP.NET Application

29. August 2010 14:50

API ASP.NET Visual Studio 

Few days back I was looking at Scott Hanselman and friend's Open Source Nerddinner project, learning and grabbing some new things from there. Apart from looking some internals I looked at the OpenID implementation. This was all a week ago and now it's time for me to write and give some thoughts on DotNetOpenAuth. For folks who are new to OpenID I am going to demonstrate how you can implement one in your project with ease.

To get started download the DotNetOpenAuth API and extract the contents from the zip file. The download also includes some samples for you to get you started. Kickstart by creating a new ASP.NET webforms project. I am just using a default template for my application, you can use the one you like or start by creating a new page. Why I am using the default template for ASP.NET webform project? well you get to know later. So now when we are done creating a new ASP.NET webform project, time to add OpenID stuff in the project. Right click References  and select Add Reference. Browse to the bin folder where you have extracted the contents of the downloaded zip file. Select DotNetOpenAuth.dll and click OK.

Changing the web.config:

A minor change in the web.config is required. Find the below lines in your web.config file:

 <authentication mode="Forms"><forms loginUrl="~/Account/Login.aspx"
timeout="2880" /></authentication>

and replace it with:

<authentication mode="Forms"><forms defaultUrl="/default.aspx"
loginUrl="~/Account/login.aspx"/></authentication>

In the above configuration, loginUrl will always point towards to the login page and the defaultUrl will always point towards the page/URL which will be displayed when the authentication is successfull.

Implemeting OpenID support:

To implement OpenID support, open login.aspx page in the design view and then drag the OpenIdLogin from the toolbox on the page just after the default login implementation ends or where you want to have OpenID login. If you are not able to view the control, then you can browse the same dll you have add a reference in the above step.

If you want to implement this manually then register the control at the top of the page and then use it on the page.

Register the control:

<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty"
TagPrefix="rp" %>

To use the control on the page you can then simply write:

<rp:OpenIdLogin ID="OpenIdLogin1" runat="server"></rp:OpenIdLogin>

All done now and it's time to test our application. Hit F5 and login with your openID. The page rendered in front of you is

Enter your openID and click login. You will be redirected to the official OpenID login page

Enter your password for openID account and after the authentication is successfull you will be re-directed to the default page. Remember the web.config configuration we did!!? If everything goes well you can see your openID name login name on the top of the page.

This is the simplest way to implement openID. You can also implement openID on your ASP.NET MVC project to add some flexibility for you site users. Apart from this you can also download the Visual Studio 2010 template

Download: DOTNETOAUTH.zip (542.85 kb)

Related Links:

Currently rated 4.0 by 2 people

Deprecated APIs In .NET 4.0

20. July 2010 11:10

.NET Framework API Visual Studio 

A number of existing APIs are deprecated in .NET Framework 4.0. A complete listing of deprecated APIs in .NET Framework 4.0 can be found here at MSDN:

 

 No Rating

Akismet Extension For BlogEngine.NET

14. May 2010 20:26

API BlogEngine.NET 

Since I have started using BlogEngine.NET I never thought of using any other open source blog engine. To me BlogEngine is the most extensible blogging platform availableat present. As a popular blogging, engine blog engine users faces a lot of spam comments. I was so totally annoyed and even after moderating comments I have to manually go and delete the comments. After some search I found an extesion from  Joel Thoms (http://joel.net). Simple and easy to use, dont even require moderation.This extension passes the commnets to Akismet spam database which then checks approves or disapprove commnets.

To get it working you need an API Key which you can get for free at http://akismet.com. Once you get an API key extract the files in App_Code/Extensions folder and jump to your Extension section under Settings.

Once you save your settings you are done. NO MORE SPAM. Laughing

Download: AkismetExtension.zip (3.55 kb)

Currently rated 3.3 by 4 people

Windows 7 Development: Creating Jumplist In Windows 7

28. March 2010 02:08

API C# Windows 

I am quite fascinated with Windows 7 before even I get it started using it. Actually I have just started on a fun project for my personal use which includes jump list. Why I am doing this? To navigate and get access to the application and internet addresses I need anytime. I am tired of typing addresses and navigating to the programs I frequently use. I have just started so I thought I must blog about my jump list experience with you all. You won't believe but I am still using Visual Studio 2008 with .NETFX 3.5. Ok, Let's talk about some Windows development. In my last post on Windows 7 development I explain how can you have Aero effects for your Windows applications. If you haven't read my post on Aero effects in Windows Application then you should have a look at this.

Windows 7 API Code Pack comes packed up with some serious development stuff for Windows 7. If you don't have it yet then check my post for Windows 7 Development resources.

We all know and view the new taskbar in Windows 7 and when your program got pinned in the taskbar you can simply left click to run your program or right-click to view more options associated with your program. To make it more clear I give you an example. I use Winsnap (a tool to take screenshots with dropshadows) to take screenshots and yes I use it quite frequently, so I pinned it to my taskbar.

That's the third icon from the Windows start button. When I click it normally it opens up the Winsnap application and show me the panel from where I can take and make settings for my next screenshot. but when I right-click the pinned Winsnap icon on my taskbar it show me the same basic settings which I will be using if I would have launched the application.

Now when I have to take screenshots with my utility I just right-click Winsnap icon pinned to my taskbar and I am done. The items that you see under the heading Tasks is having all your jump list items. It is indeed possible to have some common functions from your application to be included in the jump list or can have some external links for applications like calculator, notepad, paint etc. If you don't know (just in case) if you can pin something on the taskbar then you can also unpin it.

I hope now I am quite clear with jump list in Windows 7. So lets gets our hands on developing an application with jump list.

 

Getting Started

Start it up creating a simple windows forms application with a name of your choice. As we are delaing with Windows 7 API we need to have it added in our project references. Files you need to add to references are:

  • Microsoft.WindowsAPICodePack.DLL
  • Microsoft.WindowsAPICodePack.Shell.DLL

You can have these API libraries once you donwlod the API code pack. After you are done adding the required references, you can switch to the code window and do the rest of the work.

Creating Jump List

Start up with adding the namespace:

using Microsoft.WindowsAPICodePack.Taskbar;
using Microsoft.WindowsAPICodePack.Shell;

Create a jump list by calling CreateJumpList method, which is a part of Microsoft.WindowsAPICodePack.Taskbar.JumpList namespace.

JumpList list = JumpList.CreateJumpList();

If you want to show the most recent files you have used, then you can do that by using this line of code:

list.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;

JumpListKnownCategoryType is an enumeration which will let you accomplish this. You can also have some other available options.

  • Frequent: Display the frequent known category.
  • Neither: Don't display either known category. You must have atleast one user task and or custom category link in order to not see the default 'Recent' known category.
  • Recent: Display the recent known category.

To add some commonly used applications to the jump list then you can have it with in less than a jiffy. Create a JumpListLink class object and associate it with the JumpList class object. I use notepad a lot to note down my work, now I want to add to the jump list and I code it this way:

JumpList list = JumpList.CreateJumpList();
string SysPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System),
"notepad.exe");
JumpListLink JLink = new JumpListLink(SysPath,"Notepad.exe");
list.AddUserTasks(JLink);
list.Refresh();

One line of code can be used to include icon for your program. The IconReference property will let you add the icon the jump list item. Set the default value to '0', if you want to use the default icon for the application.

JumpList list = JumpList.CreateJumpList();
string SysPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System),
"notepad.exe");
JumpListLink JLink = new JumpListLink(SysPath,"Notepad.exe");
JLink.IconReference = new IconReference(SysPath, 0);
list.AddUserTasks(JLink);

You will now have a new jump list item. If you want to have your applications and links to be categorised in the jump list, then you can have custom jump list catgory and categorize your jump list items accordingly.

JumpList list = JumpList.CreateJumpList();
string SysPath = System.IO.Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.System),"notepad.exe");
JumpListLink JLink = new JumpListLink(SysPath,"Notepad.exe");
list.AddUserTasks(JLink);
JumpListCustomCategory jcc = new JumpListCustomCategory("My Programs"); 
jcc.AddJumpListItems(new JumpListLink("http://www.microsoft.com", "Microsoft")); list.AddCustomCategories(jcc);
list.Refresh();

Categorizing programs is bit easy this way. I can categorize web URLs, my favourites programs and some other places/links on my computer. There is lot more you can do with Jump Lists. I hope the explaination above can let you create your own applications with jump lists.

 

 

 

Currently rated 5.0 by 2 people