Dll of a single C# code behind page - c#

I a using ASP.net website - 3.5 C#
I have a modification in a .cs page, I have to deliver only updates for this code behind file only to client. Is there any way to create dll for this page in the website ?

No, it is impossible to create an assembly from a single code behind page that is part of a website project.
The web project gets compiled into a single assembly - all code behind files become part of this assembly. An update to a single code behind file means that you need to recompile the project and deploy the updated assembly.
If you can change the project from a website project to a web application, this would be a different matter, as IIS would compile all code behind files on the fly, so updating a single code behind file is possible.

To create an assembly you will need to create a project class library project. In this project you will create your .cs class file. When you build this it will produce the DLL file.
Unfortuantely you cannot create web pages in this type of project.
Now to use this in your website you can either add a project reference to this class library project, or add a file reference to the DLL it produced

Select the highlighted part as mentioned in the screen shot and Publish it.

Related

Dynamically Update Resource file in Asp.Net Mvc

I have Asp.net MVC as a Class library. All of my .resx files are also in the same class library project as Embedded resource. So basically ill get output as a dll
And my requirement is that i need a page where i can get all the key value pair from the .resx files from the dll (which is bit easy) and again update the resx in the dll to reflect the changes on screen.
So the basic idea is I need a page where i can dynamically update the .resx file which are avaliable as the external class library. And the updated resources must be seen 'AS UPDATED' wherever needed.
Any Kind suggestions or some other working approach heartly welcomed.

Extracting a class file from a Business Logic Layer DLL file and modifying it as a separate class.

I've recently taken over working on a .NET site. The original developer is uncontactable so that I don't have the source files, all I have are the aspx files and their corresponding .cs code behind files. The business logic is compiled in a file called BLL.dll
Up until now this has been fine, as I've only needed to make fairly superficial changes, that could be done by editing the .aspx or codebehind files, however, no I need to make a small change to a method contained in BLL.dll file. I've been able to decompile the files using DotPeek and can copy the code from the class file I want to edit. From what I've read, recompiling decompiled DLL files isn't advised (if even possible at all).
My question is, can a single file from this DLL be used as a standalone class file in my App_Code folder, or will there be dependencies within the DLL that can't be accessed by a standalone class.
I've tried creating it as a standalone class file, but am getting the error that 'System.Transactions' could not be found, although it seems to be working when it's referenced in the compiled BLL.dll file.
I'm a novice at .NET, so please excuse my ignorance.
Thanks

Use a class library DLL hosted on an ASPX webpage

I'm developing a webpage using the ASP.net Framework 4.0, C# and I got a DLL from a class Library. The function of this DLL is to activate and read information from a hardware CARD-READER (Client side) then I want to send the information to the server.
How can I use this DLL from a ASPX webpage?
Copy the downloaded DLL file in a custom folder on your drive, hopefully at the root of your solution maybe in a libs folder, then add the reference to your project using the Browse button in the Add Reference dialog. Make sure that the new reference has Copy Local = True set within its properties once added to the solution, which is found when un-collapsing and right-clicking on the References item in your project within Solution Explorer.
You can host it creating a XBAP, silverlight or clickonce application. The created application will run clientside.
Hope this helps.
Regards.

Website Deployment method

I have a site which is live and I only have an FTP of that site so I just want to make some changes but I found that it is a compiled site and if I have to make any changes then I have to make modification and compiled it again and upload the file.
But when I check the Bin folder then I can see that there is only one dll file is created which is named as mysite.com_deploy.dll which is combined dll file.
So I don't know how this has been published or compiled?
Can anyone let me know about this?
Your question is a bit odd... if it has a DLL then it has been compiled, one dll for the whole site or one dll per page is a compile time option.
How you publish your site (how you move the compiled code to the web server) is another matter.
Which begs the question what is your real issue?
Try right clicking on the web deployment project -> properties and in the Output Assemblies : tick the option "Create a separate assembly for each page and control output" if you want multiple DLLs for one project. Taking this route can cause potential issues with naming of DLLs if you want to replace one.
Is that what you wanted?
Try right clicking on the web deployment project -> properties and in the Output Assemblies : tick the option "Create a separate assembly for each page and control output" if you want multiple DLLs for one project. Taking this route can cause potential issues with naming of DLLs if you want to replace one.

About the deployment of website to IIS

I have created a website and deploy it on the IIS server. I want to change some code on the
the default.aspx. After I change the code on my own computer. I copy the default.aspx and default.aspx.cs file to the server. But seems don't work on the server. But the website work perfectly on my own computer. I would like to ask do I need to copy files other than the default.aspx and default.aspx.cs? Thank you
Depending on the project type, you need to deploy the assembly into which the changes were compiled. If this is a web application, the web project should have a corresponding DLL.
Is it a web site or a web application project in VS? It sounds from your brief description that it maybe a web application (code behind file) so once C# code has changed then you will need to compile it put the default.aspx and the newly compiled dll up on your hosting.
HTH
You also need to compile your solution and put latest dll of the project containing Default.aspx file, in server's bin directory, since you have made changes to code behind file Default.aspx.cs.
upload dll if you change code behind and aspx if you change design
load your page on browser,if nothing has change press "ctrl + f5" to clear cache and refresh your page

Categories

Resources