.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to prevent automatic conversion from .CSV to .XLS

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :ASP.Net
Hi, I have a web page which generates a .CSV file based on some user input. When this file is downloaded by the user, the file is being automatically converted to .XLS. Any idea how I can prevent this? For example, I am redirecting the user to the URL of the generated file, like below URL: http://localhost/reports/Work/aa.csv But the download window appears to download "aa.xls"!

View Complete Post

More Related Resource Links

How to prevent automatic update from sharepoint list on Infopath 2007 form

Hi there, I've got an Infopath 2007 form on MOSS 2007. I have a custom list in sharepoint and the infopath form has a data connection to that list to receive data. Is there any way to prevent automatic update on the values in the form that is received from the list. I'd like the new form to have updated info received from the list. However, the old/existing forms that were created should have the data that were available at the time when the form was created. Let me know if this is not clear and I'll try to explain more. Thanks,Pman http://www.pmansLab.com/

VB6 Conversion to VB.net Wrapper to prevent Null Exceptions

Thanks for reading this. We are converting a large VB6 application to VB.net. The problem we have all over the code is the .NET converter did not "reorder" the "IF" and other statements in the code to stop execution when a DBNull value exists.  For example, we have code like this all over the place. "If rRow.Item("av_election_id") > 0 And (rRow.Item("Challenged") <> "SUSPD" Or IsDBNull(rRow.Item("Challenged"))) Then" This causes a error when "rRow.Item("Challenged") is dbnull The line of code below corrects this issue but we have thousands of lines of code to reorder and refactor.  If   dtAVVoterRow.Rows(0)("av_election_id") > 0 And (IsDBNull(dtAVVoterRow.Rows(0)("Challenged")) OrElse dtAVVoterRow.Rows(0)("Challenged") <> "SUSPD") Then My question is does anyone have any idea of creating a wrapper class or something to allow us to keep the first example of code above where it will not throw an error when encountering a Null value?  I don't know if a wrapper that reordered the If statements, or captures the error but continues the execution somehow? I appreciate any help.  THanks!  

Programatically Prevent reboots due to Automatic Updates in Home editions of XP, Vista, and 7


For some horribly foolish reason MS decided it was Ok to reboot someone's PC when they aren't at it.

It causes countless people loss of data on a regular basis, and is the singular worst idea MS has ever forced upon it's user, and almost destroyed my brand new laptop!

Yes I know about the registry setting: NoAutoRebootWithLoggedOnUsers, however it is ignored on Home editions of windows, so basically MS is saying: Home users don't do anything important, F them, their data isn't of any value.

I should save you say? I do, except for working-data I need for a few hours and then am done with it; that's not worth creating a file and saving. However it's what I usually loose because of automatic updates, and there are many many posts online of people who have lost significant amounts of work. Furthermore, my PC never locks up, so I have no fear of lost data, except for from automatic updates!

I could disable automatic updates, but I'd like to automatically stay up to date with security updates.

All the above was to prevent suggestions I already know about and are not good solutions for most people, so I was not interested in hearing them again. So now we can get straight to the point:

I want, either by some programmatic method or by hacking some system file, to have the following on Home editions of Windows:
1) Still have aut

Automatic vs Explicit Properties

If the reason that motivated the change from automatically implemented property to explicitly implemented property was to change the semantics of the property then you should evaluate whether the desired semantics when accessing the property from within the class are identical to or different from the desired semantics when accessing the property from outside the class.

Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Conversion of text files from ANSI to UTF-8

reading and writing text files in ANSI format and
writing html-files in Charset ISO-8859-1 (Western Europe).

WebMatrix conversion failed when converting from a character string to uniqueidentifier?


I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

It takes 3 parameters and 1 exception.

myDll.GetXML(year, username, uniqueidentifier, out ex);

When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

Or a stack of.

System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

   at System.Data.SqlClient.SqlDataReader.get_MetaData()

   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha

Automatic Batch Printing in ReportViewer Remote Mode


Please help me, i have a properly working codes that is capable of the following:

1. Printing of Reports from ReportViewer without using the build-in print ICON in the actual ReportViewer. to view the working for the printing alone please click here.

2. Batch Printing by making a loop and placing a checkbox on the gridview where the needed paramerter (DataKeyNames ID) is retrieved then pass to the ReportViewer

This is my Code

foreach (GridViewRow row in GridView1.Rows)
            CheckBox chk = (CheckBox)row.FindControl("CheckBox2");
            if (chk.Checked)
                ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://TestServer/ReportServer");
                ReportViewer1.ServerReport.ReportPath = @"/Tavern/StudPaymentReport";
                ReportViewer1.ProcessingMode = ProcessingMode.Remote;
                ReportParameter[] rptParams = new ReportParameter[1];

                rptParams[0] = new ReportParameter("ClientID", GridView1.DataKeys[row.RowIndex].Value.ToString());


C# conversion to VB and properties


I am trying to implement image caching for a web application and I found some code on the Internet that implements an HttpHandler that does this. The code was in C# and since my web app is written in VB, I decided to convert the code to VB. I managed to convert everything except the following code (in bold):

public class FileExtensionCollection : ConfigurationElementCollection
        public override ConfigurationElementCollectionType CollectionType
                return ConfigurationElementCollectionType.AddRemoveClearMap;

        public FileExtension this[int index]
            get { return (FileExtension)BaseGet(index); }

Conversion of List to DataTable and ViceVersa


hi ,

           Iam having a requirement where I wil get datatable or Dataview from the DataAccessLayer I need to convert them into GanaricList of entites and ViceVersa from GenericList to Datatable or DataView.

             I tried it but I cant. Can anybody help me out.

Toolbox: Microsoft Chart Controls, Visual Studio Automatic Code Snippets, And More


In this installment we look at the Microsoft Chart Controls; Snippet Designer, a free, add-in for Visual Studio 2008 for creating and editing Code Snippets; refactoring SQL applications; and this month's favorite blog.

Scott Mitchell

MSDN Magazine April 2009

Toolbox: Live Chat, Code Conversion, Multiple Monitors, and More


This month, more of the tools you need to get your job done.

Scott Mitchell

MSDN Magazine December 2007

Debug Leaky Apps: Identify And Prevent Memory Leaks In Managed Code


When is the .NET Garbage Collector unable to reclaim memory? The answer might surprise you. Stay tuned.

James Kovacs

MSDN Magazine January 2007

Proxy Detection: Take the Burden Off Users with Automatic Configuration in .NET


Proxy settings can be a real pain in the neck and very frustrating for users to configure properly. In this article, Durgaprasad Gorti discusses how you can use automatic proxy configuration via script and how it works in the Microsoft .NET Framework 1.1 and 2.0.

Durgaprasad Gorti

MSDN Magazine August 2005

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend