Wednesday, February 4, 2009

Set FileUpload control in ASP.Net 2.0 to Read-Only?


We can make the ASP.Net FileUpload control readonly by setting the ContentEditable property to false.
<asp:FileUpload ID="fileUploadSri" ContentEditable="false" runat="server" />
The other way of achieving it by restricting users to type in any characters i.e. return false on key press, key up and on paste event to prevent users pasting any values directly.
Refer the below code snippet that helps in doing that,
fileUploadSri.Attributes.Add("onkeypress", "return false;");
fileUploadSri.Attributes.Add("onkeyup", "return false;");
fileUploadSri.Attributes.Add("onpaste", "return false;");

Uploading Files using FileUpload control in Update Panel in ASP.Net AJAX

By default, FileUpload control will not work inside an UpdatePanel control for uploading files using Asynchronous postback. This is because, the file uploading and file manipulations is restricted by default in client side for security reasons. Hence it is not possible to upload files using asynchronous postback in UpdatePanel.

To upload files inside UpdatePanel control we need to rely upon a standard postback i.e. we need to set the button that is uploading the file to be PostBack trigger instead of AsyncPostBack trigger. This will initiate a normal postback whenever we click the upload button and it is possible to upload the file.
Refer the below code for clear understanding,

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="fuUpload" runat="server" />
<asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
</asp:UpdatePanel>

protected void btnUpload_Click(object sender, EventArgs e)
{
string filename = System.IO.Path.GetFileName(fuUpload.FileName);
fuUpload.SaveAs("C:\temp" + filename);
}


Tuesday, February 3, 2009

Windows 7 - Next OS

Windows 7 , the next client release of Microsoft will be available in 32 & 64-bit versions.
Here are some things that you asked for in your Desktop OS:
For end –users
1. Faster-Your system starts up, shuts down and resumes from standby faster, and your laptop’s battery lasts longer!
2. Touch- Multi touch, ink and gesture support along with handwriting recognition allow you to create exciting new input capabilities. Managing large number of windows is much easier, with intuitive touch gestures to view multiple windows at once and remove unwanted windows.
3. Faster Browsing- Build for the web with IE8, add rich media with Silver light and extend to rich client with WPF – using the same platform and tools
4. Explore and Share - With Windows 7 and Windows Live, you can easily manage your documents, pictures, movies and music, regardless of which PC they are stored on, and share them with your friends and family.
5. Search- Windows 7 includes all performance improvements from Windows Search 4.0, so search and indexing are much faster.
6. Less Crashes- A new feature in Windows 7, Fault Tolerant Heap, mitigates the most common causes of heap corruption, significantly reducing the number of crashes you will experience!
7. Power Saving - Windows 7 easily adapts to your activity. To save battery power, Windows 7 automatically reduces display brightness after a period of inactivity, much like mobile phones do today.
8. Watch complete DVD on battery- Windows 7 will use less power in playing a standard-definition DVD than all earlier versions of Windows, so you are more likely to watch a complete movie with a single battery charge.
Features for IT Pros
1.App Compatibility- Windows 7 will run most if not all applications that run on Windows Vista, making Windows Vista to Windows 7 deployment easier.
2. Powershell v2 - Customers will be able to keep their PCs running smoothly with PowerShell & Group Policy management.
3. Bitlocker To Go- In Windows 7, BitLocker To Go will protect data stored on portable media (e.g., USB Flash Drives, USB Portable Hard Drives) such that only authorized users can read the data, even if the media is lost, stolen, or misused.
4. Work from Anywhere - With the capabilities Windows 7 enables, users who have internet access will be automatically connected to their corporate network. A user who is sitting on a coffee shop can open his laptop, connect to the internet using the wireless access of the coffee shop and start working as if he is in the office. The user in this case will be able to not only use outlook, but also work with intranet sites, open corporate shares, use LOB applications, and basically have full access to corporate resources.
5. “Branch office caching”- The idea is to cache the corporate data downloaded by users locally in the branch office so it can be quickly accessed by others in the branch. With branch office caching, opening a document can take seconds instead of minutes.
6. “Enterprise Search Scopes” enables IT, using Group Policy, to deploy links to appear on the user’s Start menu or in Explorer.
7. AppLocker provides a flexible mechanism that allows administrators to specify exactly what is allowed to run on their systems and gives users the ability to run applications, installation programs, and scripts that administrators have explicitly granted permission to execute. For example, a rule could be written that says “allow all versions greater than 8.1 of the program Photoshop to run if it is signed by the software publisher Adobe.”

Monday, February 2, 2009

Probable Timeout problems in ASP.NET

I've been through almost all sorts of Timeout related issues with Asp.net web service development. I’d like put a check list here to remind myself and hopefully save some headache of yours.
  1. If use database, you may get ‘System.Data.SqlClient.SqlException: Timeout expired’:
    a: Check your connection string setting for ‘Connect Timeout’: I.e.
    connectionString="Data Source=SNYC14D11511;Initial Catalog=d_dbivt003;Persist Security Info=True;User ID= user;Password= Password;
    Connect Timeout=4200

    b:Check your command object
    SqlCommand.CommandTimeout Property, it’s by default 30s
  2. Check you Web.config setting when you get error like ‘Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.’:
    ….

    executionTimeout="1200"/>

    make sure your set 'compilation debug="false" as well to let timeout setting take effect. Check MSDN for details.
  3. Set your proxy class Timeout property (derived from WebClientProtocol.Timeout Property) at client if you get error like this ‘The operation has timed out’: I.e.
    proxy.
    Timeout = System.Threading.Timeout.Infinite;
  4. If you are like me, use VistualStudio unit test tool and you get a blue icon and error ‘Timeout’ in your test result pane, you need to check your test config file localtestrun.testrunconfig. The last item ‘Test Timeouts’ is the key. It’s 5 min by default.
  5. Last one and every web developer should know is the IIS server setting such as Keep Alive and Connection Timeout

Sunday, January 11, 2009

ASP.NET 3.5 Specific Features

Please refer the following site for specific features of ASP.NET 3.5
http://www.devx.com/codemag/Article/38741

Thursday, January 8, 2009

'Weakness of attitude becomes weakness of character' - Albert Einstein

The Japanese have always loved fresh fish. But the water close to Japan has not held many fish for decades. So to feed the Japanese population, fishing boats got bigger and went further than ever. The further the fishermen went, the longer it took to bring the fish. If the return trip took more time, the fish were not fresh. To solve this problem, fish companies installed freezers on their boats. They would catch the fish and freeze them at sea. Freezers allowed the boats to go further and stay longer. However, the Japanese could taste the difference between fresh and frozen fish. And they did not like the taste of frozen fish. The frozen fish brought a lower price. So, fishing companies installed fish tanks. They would catch the fish and stuff them in the tanks, fin to fin. After a little thrashing around, they were tired, dull, and lost their fresh-fish taste. The fishing industry faced an impending crisis! But today, they get fresh-tasting fish to Japan ..

How did they manage? To keep the fish tasting fresh, the Japanese fishing companies still put the fish in the tanks but with a small crook. The fish are challenged and hence are constantly on the move. The challenge they face keeps them alive and fresh!

Have you realized that some of us are also living in a pond but most of the time tired and dull ? Basically in our lives, sharks are new challenges to keep us active. If you are steadily conquering challenges, you are happy. Your challenges keep you energized. Don't create success and revel in it in a state of inertia. You have the resources, skills and abilities to make a difference. Put a shark in your tank and see how far you can really go!

Proud to be part of the Satyam company.

The day before all this mayhem started, all employees of Satyam were proud to be called as Satyamites and was wearing the Satyam tag displaying their esteem to others, and now due to this incidence most of the employees are feeling awkward to show the same Satyam tag in public.


In our country some many unpleasant incidents are happening, but still we are proudly says we are Indians, then why not for Satyam?

Proud to be a part of company, not only for Satyam every employee should proud of his company. If you commit a mistake then you can feel shy, if someone else does then why you? Think of it my friends.

I am not from Satyam. Think broadly, we are educated and knowledgeable persons.

What we have learned from Satyam incident. . Moral

A day after, when the entire world is considering Mr. BR Raju as criminal let us just look around on what we should learn from this incident.

Everybody must have read lots of stores including his own letter to board which was circling on the net. I am not going into the details of the letter but few other things beyond that.

We all know Raju is the founder of the Satyam and with his abilities he took the organization to the one of the world’s best organization. We should really appreciate his efforts and today more than 75,000 families are depending directly or indirectly on this organization. We all should be very proud of him.

While this process he forgot few basics and we just look into that.

·Owning a business: You can own a business only by having major shares in that. In no other manor you can own that for a long time. For may be any reason he and his directors sold the shares and they had faced the takeover threat. He used all the other tactics to be the king and proved to be futile.

·Openness: Trust comes from openness. As Raju unreeled the secrets the entire world considering him as fraud person even though he had not done anything for his personal gain. Whatever he did, he did to keep his organization as one of the best. In this process he even pumped in the 1250 Crores of personal money into the company which he can never recover. But in the process he lost everything, money name and fame because he is not open.

He has done nothing wrong other than discussed above. But at this juncture it is more important for everybody to support the 75,000 families dependent up on this organization.

One thing we should remember that the company is still intact. Still running in profits. Still having the customer confidence. Only thing it has lost is the moral. Of course if your leader and your role model is being doubted by the entire world, you automatically loose the moral. If you lose money you can earn, if you lose name still you can recover. But you lose moral you had lost everything.

Now it is in the hand of the employs to keep the organization intact.

  • Stick to the basics: Work your best. You will get the best salary. This applicable to all the departments including sales, key account management, finance, not to mention the basic IT service people.
  • Keep your customer happy: If you deliver the best to keep your customer happy, he will definitely deliver the best to you and to your organization.
  • Never lose Moral: As said earlier never lose your moral. Put off TV and news papers.
  • Enron or any other company were became bankrupt after any scandal were erupted. If all people stood together bring Satyam back into limelight and it will be miracle in the Indian history and India would automatically become No 1 country.

10 Ways to Benefit even in this Slowdown


















Today’s volatile marketplace has
businesses in a fix. Companies are exploring all possible means to
bolster their wafer-thin margins.
With
this background in mind, we have started an initiative (Control
Costs) that looks at how businesses can control costs without
cutting down on their technology budgets.









What's
the Control Cost Campaign?


The
Control Costs campaign is a 360-degree integrated campaign
that involves:



  1. A
    nation-wide Print campaign that has started from early
    December 2008. This will reach out to decision-makers through
    national general interest and business magazines like India Today
    and Business World. The campaign features testimonials from
    CXO-level functionaries of enterprise companies such as Star
    India, Lavasa, Lilliput, etc, on how Microsoft solutions have
    helped their business.
  2. A
    Television campaign
    that explores the business dilemma of CFOs
    and highlights solutions from Microsoft.
  3. A dedicated Website portal www.controlcosts.com which describes 10
    solutions from Microsoft that businesses can use to control costs,
    and includes benefits, case studies, analysts quotes, and so on.
  4. Other
    campaign activities planned include:

    1. A Digital campaign that includes banners, eDMs and
      viral videos.
    2. PR activities with articles appearing in The Economic
      Times and coverage in TV shows on news channels.





Who
can be a part of the campaign?


As
a partner, you can benefit from the Control Costs campaign, if you
fulfil certain competencies. Just check the table below to verify if
you match the following competencies. If you do, then just contact
us.




































Unified Communications Unified Business Solutions
Virtualization Advanced Infrastructure Solutions
Business Intelligence • Business Intelligence

• SOA and Business Process
Collaboration Information Worker Solutions
CRM & ERP Microsoft Business Solutions
The Desktop
Experience

- Microsoft Windows
Vista
- Microsoft Desktop
Optimization Pack
Advanced Infrastructure Solutions
Customer Care Framework SOA & Business Process
Infrastructure
Optimization

- Core
Infrastructure
- Business
Productivity
- Application Platform
• Advanced Infrastructure
Solutions
• Security
Solutions
• Information Worker
Solutions
• Networking Infrastructure
Solutions
Hosted Services Hosting Solutions
Licensing Licensing Solutions





How
can partners register for this
campaign?


If
you fulfil the competencies mentioned above for one or more
solutions, or if you have signed a Partner Solution Plan with
Microsoft, and want to be listed as a Partner for the Control Costs
campaign, send us your request at ctrlcp@microsoft.com on or before January 16,
2009. We will get in touch with you on
how we can collaborate together to drive business opportunities.


I
look forward to your support, and wish you a happy New Year.



Rajeev Mittal
Group
Director,
Small & Mid Market Solutions &
Partners