Monday, September 15, 2008

Response.End and download file problem using asp.net code inside sharepoint

Issue:

To download file from Sharepoint doesn’t work but works fine in plain asp.net environment.

Solution:

Solution is very simple, Add the following code for the button or link which initiates the download:

MyButton.OnClientClick = "document.getElementById(""" & Me.Page.Form.ClientID & """).onsubmit = function() {return true;}"

Link: http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/107b2c17-07fe-4a15-ad81-dcb31e1e9c84

Friday, September 12, 2008

Impersonating in Windows (WinForm)

Impersonating in asp.net is as simple as just adding a tag in web.config but in windows I found few links which were using kernel dll to impersonate. Article I found on theserverside.net shows new features in .net 2.0 which makes it very easy to do this.

Quote:

System.Diagnostics.ProcessStartInfo pInfo =   new System.Diagnostics.ProcessStartInfo();
            SecureString ss = new SecureString();
                          ... append password characters
            pInfo.Password = ss;
            pInfo.UserName = @"domain\alice";
            pInfo.FileName = @"c:\windows\notepad.exe";
            pInfo.UseShellExecute = false;
            Process.Start(pInfo);

Link: http://www.theserverside.net/tt/articles/showarticle.tss?id=NewSecurityFeatures

Wednesday, September 10, 2008

SPTraceView - Lightweight Tool for Monitoring the SharePoint Diagnostic Logging in Real-Time

Very small application, only 65kb zip, great tool for SharePoint diagnostic tracing

Quote:

SPTraceView moniors in real time all SharePoint diagnostic tracing (also called ULS tracing) and can notify you using a balloon-style messages in the tray bar when any information of particular interest to you is sent (traced) by any of the MOSS services and components.

Link: http://hristopavlov.wordpress.com/2008/06/19/sptraceview-lightweight-tool-for-monitoring-the-sharepoint-diagnostic-logging-in-real-time/

CoreFtp - Free Excellent ftp application

Used to have problems with FileZilla uploading files, it would upload files with 0 bytes. Found this new program, works great and lite weight. A must have for ftp users

Quote:

This free, secure FTP client gives you a fast, easy, reliable way to update and maintain your website via FTP. It also provides a secure method (via SSL, TLS, or SFTP) to upload / download files to and from FTP servers. Check out the list of features and you'll find almost every feature you need, all in a free ftp program. There are no popup ads, advertising or spyware and you're never asked or reminded to register.

Site Link: http://www.coreftp.com/

Download Link: http://www.download.com/Core-FTP-LE/3000-2160_4-10195752.html

Play with spider

Saturday, September 6, 2008

OLE DB Connection string issue using Excel

Issue:
I came across two issues while trying to load a excel file in asp.net. I'll explain both of them separately.

1). Exception: The Microsoft Jet database engine could not find the object
This exception happens when the path is not fully qualified to the excel file used in the oledb connection string. Without path, its not going to through an exception while creating connection.

Before: Dim dsn As String = "provider=Microsoft.Jet.OLEDB.4.0;data source='MyFile.xls'; Extended Properties=""Excel 8.0;HDR=NO;"""

After: Dim dsn As String = "provider=Microsoft.Jet.OLEDB.4.0;data source='" &
Server.MapPath("MyFile.xls") & "'; Extended Properties=""Excel 8.0;HDR=NO;"""

Solution: use Server.MaptPath to get fully qualified path to a file to avoid this exception.

2). Exception: Could not find installable ISAM.
When using extended properties be careful with the syntax

Before: Dim dsn As String = "provider=Microsoft.Jet.OLEDB.4.0;data source='MyFile.xls'; Extended Properties=Excel 8.0;HDR=NO;"

After: Dim dsn As String = "provider=Microsoft.Jet.OLEDB.4.0;data source='" & Server.MapPath("MyFile.xls") & "'; Extended Properties=
""Excel 8.0;HDR=NO;"""

Solution: use quotes around the value of extended properties. If the syntax is wrong, it tries to look for another driver.

Tuesday, September 2, 2008

Virtual Clone Drive - Great tool for ISO mapping as a drive

Quote:

Virtual CloneDrive works and behaves just like a physical CD/DVD drive, however it exists only virtually. Image files generated with CloneDVD or CloneCD can be mounted onto a virtual drive from your hard-disk or from a network drive and used in the same manner as inserting them into a normal CD/DVD drive.

Probably the best virtual drive software, Virtual CloneDrive allows you to enjoy the freedom of a virtual drive and is completely free.

Link: http://www.slysoft.com/en/virtual-clonedrive.html

Google browser is here, today!

Long awaited, there had been rumors for about 2 years that google is coming up with their browser. Initially I thought it'll be some sort of firefox extension or built on top of it but apparently its not.

It'll be interesting to see what Microsoft reaction will be on this. Seriously, I'm tired and sick of IE, it sucks real bad as compared to firefox. It is still trying to barely catch up with firefox and here comes the new rival! I'll update this post to add the link to the site since its not there yet. Hoping to see it in next few hours.

News Link: http://news.yahoo.com/s/ap/google_browser;_ylt=AvYgJ5cZ5H.Sui7LU4Cx7TUDW7oF

Official Site: http://www.google.com/chrome