I need to use excel automation in my ASP.NET web app. I am trying to import it in a .aspx file using the following code:
<%# Import Namespace="Microsoft.Office.Interop.Excel" %> however, when I open the page in the browser I get the error The type or namespace name 'Office' does not exist in the namespace 'Microsoft'. So I assume I have to add some library to my project. I am using IIS 7.5 to create this web app, not Visual Studio. So is there a way to import external libraries into my ASP.NET project in IIS?
Right click on the Reference - .Net tab - Microsoft.Office.Interop.Excel
Excel 2010 use version 14 / Excel 2007 use version 12
click ok.
You should be able to drop the Microsoft.Office.Interop.Excel.dll into the bin directory. If that doesn't work try adding it to the <assemblies> in your web.config file.
Assemblies in Web.config
Related
Created an ASP.NET empty web application in Visual Studio
Installed Umbraco 7.1.5 via NuGet Package Manager
When asked to overwrite the web.config file, typed Y(Yes)
Built the project
F5
When I run the project I get the following error in Chrome:
How can I solve this problem and get to the installation page?
I also encountered same problem few days ago..i solved that...Just change the name of MVC project from 'Umbraco' to something else and then it will work fine..
The solution, when I encountered it after installing Umbraco 7.2.12 into an existing but empty project, was to change the assembly name and default namespace from "Umbraco" to the name of the (startup-)project eg. "Website".
In Visual Studio 2017 (applies to many other versions of VS), you can do it like this:
Select your project
Select Properties
Select tab Application
Change Assembly name and Default namespace
Save ... and wait
Run
I have got a .aspx file containing code to look up data from a MySQL server. When I use visual studio (VB) and import the .dll my code works fine. However, I am not sure how to reference the .dll in asp.net (I am using notepad for creating my .aspx file, and hosting using Microsoft IIS 8.0)?
.NET Applications look for DLLs referenced in their code in the 'bin' folder of their project, and the GAC (Global Assembly Cache) where you put system shared DLL's, if not found in the local 'bin'.
If you ensure that you have your DLL in one of the places, you can develop code as you would do in VS after referencing the DLL.
Another option is, adding the <%# Assembly Name="" %> directive in that a particular ASPX, or to the <assemblies> section in web.config if you will need to use it in more than one of your ASPX pages.
I am working on a website written 5 years ago in asp.net 2.0 and vb.net 2005 and visual studio 2005
The website uses a data access layer written using subsonic. The DAL is a class library which imports the subsonic dll. It also needs to import the mysql.data dll to connect to an underlying mysql database. Subsonic needs a specific version of the mysql.data connector (5.2.2) and so this is the version the class library imports.
The website also uses a custom membership provider for mysql. This is another class library which mysql.data dll version 6.5.4
The website uses both the DAL and the custom membership provider and so imports the dlls for both of these class files. I'm confused how it can handle the 2 different versions of the mysql data connector used by these class libraries
The web.config file has this line
<add assembly="MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/></assemblies>
If i delete this line and then rebuild the website the line appears again.
The website also has a copy of the mysql.data 5.2.2 dll in the bin directory. If i delete this file and then rebuild the website the file appears again. In other words the name of the dll appears in the bin directory in the explorer window of visual studio and the physical file appears in the bin directory of the website.
I would really like to know what is going on here and how vb.net can use 2 versions of the same dll. Everything seems to be working ok but the components in this website are so old that they are unsupported. I really don't want to break anything and then not be able to fix it.
Thanks a lot
I have some webforms in an Asp.Net V2.0 generated using Visual Studio 2005 using Web site technology
Want to import them in to Visual Studio 2008 set to v3.5 (Asp.Net MVC) - where I use Project technology
I'm using Add > Existing Item - Which brings in Whatever.aspx & Whatever.aspx.cs
There is no Whatever.aspx.designer.cs to import
How do you force it to be generated ?
Right-click your aspx file and select Convert to Web Application.
You have to make sure that your project is a Web Application (and not a Website). Then, You can right-click on the file or the project and select "Convert to Web Application". If all goes well, the designer file will be created. If not, then there is a parsing error in the page.
But if you want your project to truly be a MVC application, then you should not be using code-behind files for your webpages (Views), so you need to refactor the codebehind classes into Controllers. See this article why not:
http://stevesmithblog.com/blog/codebehind-files-in-asp-net-mvc-are-evil/
What is the difference between CodeFile="file.ascx.cs" and CodeBehind="file.ascx.cs" in the declaration of a ASP.NET user control?
Is one newer or recommended? Or do they have specific usage?
CodeBehind: Needs to be compiled (ASP.NET 1.1 model). The compiled binary is placed in the bin folder of the website. You need to do a compile in Visual Studio before you deploy. It's a good model when you don't want the source code to be viewable as plain text. For example when delivering to a customer to whom you don't have an obligation to provide code.
CodeFile: You provide the source file with the solution for deployment. ASP.NET 2.0 runtime compiles the code when needed. The compiled files are at Microsoft.NET[.NET version]\Temporary ASP.NET Files.
I'm working with an Application Project in Visual Studio Express 2012 For Web and using .NET 4.0. In the code behind files for my login and change password pages I found a situation where I needed both CodeBehind and CodeFile in the declaration.
If I don't add a code file reference like
CodeFile=login.aspx.cs
The web page doesn't parse and the browser displays a parser error. It doesn't matter whether I compile the project or not.
If I don't add a code behind reference like
CodeBehind=login.aspx.cs
References to Security classes like MembershipUser fail both at compile time and when attempting to use intellisense with an error like "The type or namespace MembershipUser cannot be found". I have added a reference to System.Web.ApplicationServices as required by the .Net 4.0 framework.
I should add that these troublesome files are running in an application within the website created using the IIS Application tool. When I open the website from Visual Studio I have no difficulty with parser errors or reference errors. This confusion only occurs when I open the application as a project in Visual Studio.
Codebehind file need to compile before run but in src we dont need to compile and then run.. just save the file.