Feeds:
Posts
Comments

We all are always looking for some good third party controls. I had some experience with infragistics control and two years back, they use to suck bad, completely refusing to work in a shared hosting environment. So at that time, when we developed one of our website and deployed it on a share hosting account, every page with an infragistics control crashed, as they all required full trust, which would never be available in a shared hosting environment. After a long exchange of emails with the infragistics team, who continued to advise us to talk to our hosting provider, we concluded that we need to remove infragistics completely from the application and eventually write all the controls by ourselves. No need to mention that never again did we touch  infragistics.

And then I came across obout controls, which are actually very good though they need to be a bit better in terms of programming integration, eg. their slide controls can get better if they provide some property like DataSource and a simple binding could do the job instead of running a foreach loop on the datasource and doing the dirty work.

They have a long range of products including tree view, calendar, HTML editor, fly outs, slide show alongwith a very rich set of tutorials. They provide about one month free trial and some of their products are completely free. Highly recommended.

Task : As soon as user logs into the website, he remains logged in even if he move across sub domains.

eg. if user logged in to the website using www.domain.com, now via a link, he moves to subdomain.domain.com then he should not be required to re login.

Solution :

In order to achieve this, you need to take two actions,

1. Make the following changes in web.config :

Within System.web element, add the following,

<authentication mode=”Forms”>
<forms path=”/” name=”.cookieName” cookieless=”UseCookies” domain=”.domainname.com“/>

</authentication>

If your site’s domain address is “www.sitename.com” then domain will be set as “.sitename.com”

2. Add the following code piece to the code which runs on logout,

HttpCookie cookie = Request.Cookies[FormsAuthentication.FormsCookieName];

if (cookie != null)

{

cookie.Domain = FormsAuthentication.CookieDomain;

cookie.Expires = DateTime.Now.AddDays(-360);

Response.Cookies.Add(cookie);

}

FormsAuthentication.SignOut();

If you use a single domain then it’s not required that you explicitly expire the authentication cookie, a simple ForsmAuthentication.SignOut() should work fine, but once the cookie domain is set then you will need to expire the cookie explicitly, otherwise your user will remain logged in.

Once you have done both the actions, your job is done and your user’s login should work for the main domain and all the sub domains.

Next Problem >> Though this solution will keep the user logged in but every time when he will move to a new sub domain, his session will renew, any information which you placed into the session at the time of logging in will be lost too. The informatino can be refilled but more than that it’s a performance issue.

Let’s discuss this in Part 2.

So heres another recommendation from me.

If you have ever tried to use ASP.Net’s File upload control along with Ajax then you would know that PostBackFile property will be null, no matter what you do , how much you pull your hairs out, its not gonna work.

Four years back, I had to write a control which could upload files just like GMail, (thats without posting the page) – yeah these were the exact words of my manager. I wrote it, it worked but it was always such a pain to integrate it into a new project and too much of work was involved. And at that time, any search for such a control gave dry results.

But recently, I came across this control namely “File Upload Ajax,”  its simple and it works. You can access it here,

http://en.fileuploadajax.subgurim.net/

But its not perfect, they need to make it a bit more generic. The only problem that it created was it was somehow doing something to Request collection and it was coming as ‘null.’

Every now and then , we all need to add ajax to our web page. Ajax is good, it creates a great experience but like many other things, it has one side effect. User never gets to know if page is stucked or is there something really happening. So, Ajax.Net gives you ProgressUpdate control, just add some text or image to it and it will do the rest. And then instead of asking your Graphic designer, you can go straight to  http://www.ajaxload.info/ and get an icon with look and color of your choice.

I love it. Its so simple, yet so useful.

Well, if you have ever tried to manually uninstall SQL Server 2005 or onwards then you would definitely know the pain. There are so many components in it and we definitely don’t know the right sequence of deleting them. So unless a miracle happen, you will be getting an error of something like ‘X depends on Y, so dude you can’t delete it’ or worst ‘X did depend on Y and now that you have deleted the Y , so just go and pull your hairs out.’

Mercifully, Microsoft has this cleaning utility which works like a charm and is unbelievably fast. You can delete everything blindly. you can check it here

http://support.microsoft.com/default.aspx?scid=kb;en-us;290301

Well, Google Earth gives the sky view too and quite a view it is, so Microsoft is here with the worldwide telescope. Being the second one to implement a functionality means that you have the chance of doing it better. Lets see how it is, its suppose to be out by spring 2008. You can check the site here,

http://www.worldwidetelescope.org/ 

Google Sites

Its one of those things which make your pulse move fast. Being a project manager, I am always on the lookout for anything which can make the management task easier and efficient, so that I can focus more on the technical stuff. And Google sites seems one such solution and its not just bound to intranet due to various licenses but its available on net! This is what they are saying

“Google Apps Team Edition is designed to enable easy collaboration and communication with other people at your school or business. Your account is automatically linked with all other accounts from your organization “

For more details, check this link

untitled1.jpg

The merger of Google Calendar, Documents, Spreadsheet, Presentation seems a perfect match for maintaing a project. You just have to add a few widgets and everything is ready to use.

google.jpg

Storage space is 10 GB and with 50 $ per user per year , you can increase the space. And the best thing is that you are not required to use a gmail account – so your organizational email addresses can be use easily. Don’t you just love Google.

I won’t be writing anything about it, ScottGu has discussed it fully at his blogs,

http://weblogs.asp.net/scottgu/archive/2008/02/12/asp-net-mvc-framework-road-map-update.aspx

Its surely some thing which I am looking forward to, as its mean a more maintainable code. I simply love this, another thing on my list of ‘check-it-out’

In order to run properly every application needs data or resources, eg. a site which sends emails to its users would be saving the email templates somewhere on the hard disk. Keeping this kind of stuff in configuration file is a recommended approach but that doesn’t take off the burden and chance of error.

So, Microsoft has come up with this ‘Open Packaging Conventions,’  it stores application data and required resources in one file container using XML and Zip technology. Its an open standard and ECMA(association dedicated to the standardization of Information and Communication Technology (ICT) and Consumer Electronics (CE)) has approved it.

It would allow platform independent, efficient information exchange. And the best thing is that it points the files within it in such a way that if you want to change the file location, you can do it easily and make the change at just one place, even if you have used it at more than one place. This is what wikipedia says,

“An OPC-aware application will use relationships metadata rather than directory names and file names to locate individual files.”

Microsoft Office 2007 is using it, so it is here to stay. The .Net 3.5 provides namespaces to create OPC packages. Information exchange is one of the most critical topics in the IT world, so I do think that its something important to look into.  On the next weekend, I would be making a sample application and would update you about my experience.

Few months back, I was in my office enjoying my green tea and reading an article about Brad Pitt and Angelina Jolie, suddenly my mIRC window started blinking, I opened it and to my horror, it was a personal message from one of the QA guys (who was testing my application), he was asking me that ‘is there any size limit on attachments?’ As I hadn’t placed any size constraint, I replied in negative, but I started to have a feeling that a bug is just around the corner and so it happened. He went excited and informed me with great enthusiasm that when he tries to upload a 5 MB file, application shows him a ‘Page Not Found’ error. I asked him to post the bug, then closed the article on the two Hollywood stars and in order to find the reason/solution I turned to my old buddy , ‘Google.’
Within 15 minutes I realized that every second ASP.Net programmer has faced this problem and still there is no good solution to it.
The problem was that by default ASP.Net ‘FileUpload’ control allows files of size 4 MB or less, anything bigger then that size will redirect you to a DNS error. The main reason behind this constraint is to prevent denial of service attack in-case users posts files of extremely large sizes.
The solution was quite simple, in web.config’s element; you just need to set the value of ‘maxRequestLength’ to your desirable maximum file size. easy!
But, it’s not that easy, anything greater then that size will stillredirect you to DNS error page. We certainly don’t want to let our users see that page, instead we would like to show them a good error message saying something like ‘files size should be less than {0}.’ For your disappointment, I must confess that there is simply no solution to it. You just don’t have any control on the process; no implementation of IHttpHandler can help you in this regard. One of our friend’s on thislink tried to provide a solution but it just doesn’t work for about 90% of the people (including me). Whenever the file size was largeer than the maximum allowed size, Reques.Files.Count was somehow ‘0.’
Microsoft provides a little bit of help, which you may access at,
http://support.microsoft.com/default.aspx?scid=kb;en-us;295626Now, that’s not all, there is something more to this problem, ASP.Net uses physical memory to upload a file and whenever ASP.Net process uses 60% of RAM, .Net services restarts. Hopefully, you can appreciate the magnitude of the problem. And to make it a bit more convoluted, IIS has its own file size limit of 4 GB.If you’ve visited the MS link, then you can see that MS knows about the DNS thing, still they are trying to become oblivious to it, so we should read between the lines, that they want us to go for a third part control. Yes, if your expected file size is small then go for this control, otherwise I would recommend you to go for a 3rd party control.
Happy coding!

Older Posts »

Follow

Get every new post delivered to your Inbox.