Distribute ASP.net Application - asp.net

I have an ASP.NET application and i selling it to different companies. I change the application settings according to the company information and publish the whole application to a output folder. And then take the output folder to clients machine with necessary dlls(My application dll and few third party dlls). I am wondering if it is possible for anyone to decompile the code from the dll's in bin folder and get the application code? Is there any standard process i need to follow so the my code are safe in client server.

You would need to obfuscate the dlls created for your project, but there are some issues with that related to ASP.NET. See this stackoverflow post
Enjoy!

Yes.... And see other answers for how to avoid it.

You can also try Redgate's SmartAssembly

Rather than Xcopy deploy, you should look have a look at web deployment projects for your deployment - http://msdn.microsoft.com/en-us/magazine/cc163448.aspx.
If you need to protect your assemblies from reverse engineering, you need to look at an obfuscator like http://www.preemptive.com/products/dotfuscator/overview

Related

What is the best way to set AutoDeployment for Dot Net Nuke Web Site in TFS

i am looking for a way to autodeploy a Dot Net Nuke website by TFS after checking in. I also need to some how transform web config to the right connection for the deploy server.
Since this is a website but not a web application, thing becomes tricky. If you have done it before, please give me some idea.
Thanks
I have not done auto deployment with TFS but did automate the process with SVN. What we did is simply have the script deploy everything that had changed since last login to the web server - EXCEPT - the web.config.
Database scripts were handled by a process like this but those were not as reliable as the SVN code deployment was.
HTH
You could use a deployment tool such as kwatee (self promotion). Kwatee is configured via a web GUI and can then deploy any application or site via python scripts and transform files along the way.
You can use Visual Studio web deploy feature. ALM Rangers shipped a ready to use BRDLite Reference template for this purpose which you can download here. Also, check this link for documentation for the template usage.
If you're using VS2010, you can use a Web Deploy Project in your solution. TFS will talk to the WDP as it would with a web application's project file.
For config transforms, you can use a tool called SlowCheetah.

Publishing an asp.net web application

I want to know a few things about Publishing an asp.net web application,
Why should i publish my web application?
What are the advantages of publishing a web application?
1- if you want to crypt your configuration settings you should publish. http://msdn.microsoft.com/en-us/library/53tyfkaw%28VS.80%29.aspx
2- first if you just copy your web site to your IIS it will compile first then starts serving. publishing wins that compile time. second if you want to send just dlls to your server it will be easier to deploy.
my personal opinion if you are the only developer on the project and you may need to change stuff on an editor like notepad and deploy ASAP then dont do it.
but if you have a big team and timeline and deploy is a one of a big issue for project. you need to do that to keep track.
You should use web application because of the advantages of Web application. :-)
I think web application has some advantages:
Web application will be compiled before published, so the code will be checked by compiler.
One web application(project) has only one DLL file.
use dll file and not use source code
can encrypt file

How to publish ASP.NET website with alternative configuration settings

I am working on a web project as a Web Site, rather than a Web Application. How can I use a different config file depending on where it is hosted from, so the local version uses my local SQL install, but the published version uses the live database? e.g. connectionStrings.config ignored (not published), connectionStrings.live.config published as connectionStrings.config
I see a policy file option, would that be something able to do this?
There are several options regarding this. The simplest is to use a web deployment project. The ScottGu's post goes into more detail on this.
For larger projects you will need something like Nant or MSBuild and CruiseControl or TeamBuild.
I also posted something here a while back on supporting complex config deployments
Use a MSBuild or NAnt script for different builds.
You can use a Web Deployment project. Check out ScottGu's blog post.
Post Build Event which swaps the config over?
you can have a different post build event depending on your build configuration, each can copy a different config if needed.

Subversion and using IIS for ASP.NET development

I'm a total newbie to SVN and haven't been able to find an answer for the following situation.
I have an ASP .NET 2.0 web app that I am developing. I am using my local IIS as the development web server (i.e. not the Visual Studio web development server). My development environment is VS2005, Vista, IIS7, TortoiseSVN / AnkhSVN. VisualSVN is installed on the server.
My .sln files and class libraries, etc. are located in the **C:\Localsource\Projects\ProjectName** folder, and my .aspx files are in my **C:\inetpub\wwwroot\ProjectName** folder.
I can set up the repository for **C:\Localsource\Projects\ProjectName** fine, but can't think of a way to set it up for the IIS folder as well in the same repository.
What's the best way for dealing with this development environment in SVN?
Many thanks,
Ant
In a solution in Visual Studio you can have a class library project which is usually in a directory underneath the .sln file.
In this case he also has a web project within the solution but NOT underneath the .sln file in the file directory structure.
He will be attaching to this project via HTTP not via local file path.
IIS will manage this as http://localhost/webapp and by default will place it in c:\inetpub\wwwroot\webapp. The files in webapp folder will not be in the repo as they arent in the hierachy of the solution and the class library. This is his question how to sort it out.
My answer is to move http://localhost/webapp to point to a folder that is underneath the .sln file and adjacent to the class library directory then it can all go in the repo.
Seperating the class library and the the webapp is best practice to aide code re-use and decoupling the logic from the web site.
Can you not just point IIS to C:\Localsource\Projects\ProjectName and set the permissions?
Hmmm - Good point. It was set up like this when I got here, and Visual Studio always creates websites in the wwwroot folder, so I assumed wwwroot was just where they had to go.
Maybe I'll have to think about doing a little rearranging...
Thanks!
The IIS folder is not the output of the code base it is part of the application. It's not CGI output or anything but actually the scripts to run the app!
This is the .aspx pages that will have user controls and HTML to actually run the application. Its part of the applciation but split away from VS Studio solution.
The easiest way is to have a solution and then C:\Localsource\Projects\ProjectName\WEBSITE.
Point IIS at that folder as well.
OK, I may be being stupid here but.. Why do you need to add the IIS folder (i.e. the output of the code base) to your repository?
Update
I think I should clarify this a bit more.. What I mean to say is I am not sure why the ASPX is seperate from the project anyway? What is wrong with an Web Project and n Class Library Projects in a Solution, added to your repository.. You then publish on each new release..
If it is simply a case of "it might be easier to roll back the published output" then so be it, I was just curious as I have not seen many people actually work that way.
Deployment of solutions in this structure would be a lot easier as well..
I think you might want to separate this into two problems, following this recommendation from Dillorscroft.
First, with regard to the material on your development server that is published to the production site, I think you need version control for that. First so you can roll back any page, and you can also decide when you have a stable level of the development site that you want to extract to production. (I would get that from the source control system into a site image and then synchronize that image with the production site.)
So, for the first part, we are talking about versioning the web pages and all of the custom server-side material that supports the web site.
Secondly, With regard to the development of components that are used on the site, they need their own development projects, since it is the result that goes to the development site, not all of the source, libraries, etc. that the component is built with. So these will have their own project development tree (think of it as if you were building a library that is to be used by other development projects, although in this case the other projects are web pages). So the only thing that should show up in IIS is the "deployed" component to the development site.
There seem to be three critical questions for you:
How development of tests that need to go against the web site is handled and where that is version controlled (assuming they do not belong on the web site itself)
How easily you can arrange to make sure that all content on the development web site is kept under version control and checked-in and -out appropriately. (This has to do with the tools you use to edit web pages and other server-side gunk other than components developed off to the side.)
Easily taking developed components from the projects that produce them to the development site and have them be checked-in there.
My solution to (2) and to version control of the development web site is to use Visual Source Safe integration with IIS and FrontPage extensions that places the site under version control. Components produced from other development projects are mapped to the server project by VSS sharing.
For SVN, I speculate that (1) you want to see if there is an SVN adapter that IIS will recognize as an external source-control system and, either way, (2) have a discipline that takes delivery of components from their construction projects into the overall web site project.
Rob,
Why do you consider an .aspx file an output of the code base?
It is part of the code base. It's not an output after compilation for instance.
Just wondered?

install ASP.NET + SQL Express in a script

I need a little help on this subject.
I have a Web application written in ASP.NET plus I have the .bak file of the SQL Express database, my question is: How can I install this in a simple click and go way in the client?
how can I write a script that will create a new database, restore the bak file into that database, set up IIS and ... well, that's it :)
I do this all manually, and I do this a lot, so I was just asking if there is a way to prevent do all this steps manually.
Thanks.
You could use WiX to create a .msi that you can use to install your application at your clients. WiX takes a bit to get used to, but once you get the hang of it, you'll meet your needs above, and be able to extend them as your application grows or increases in complexity from the installation point of view.
I read your question to mean you have several clients where you install your application, if that is not the case, and your app exists in one place, there are better solutions, and better people to give them to you!
While WIX is certainly very flexible if you aren't comfortable with the learning curve (and there is a bit of a learning curve IMO) then perhaps you should check out the Web Deployment Projects.
From the blog post:
Web Deployment projects can be used with either the "ASP.NET Web Site" or "ASP.NET Web Application Project" options built-into VS 2008, and provide a few additional build, packaging and deployment options for you to use.
Regarding the database, I'd suggest that you utilise the App_Data directory and just deploy the ".mdf" file. This would be easier than trying to create a new database and restoring a backup.

Resources