Visual Studio 2010: Data Sources window in ASP.Net project? - asp.net

I'm trying to add a Sharepoint site as a data source on a web project in VS2010; so I can generate the appropriate DAO code to interact with the site's data over REST. However, neither the data sources window, nor the Add Data Source Configuration Wizard seem to be available to an ASP.Net Web project. Is there something else I should be using instead? I know I could just create a class library project and add my Datasource there, or I could just manually make the REST requests; but I just want to see what my options are. Any constructive input greatly appreciated.
Thanks,
Frank

If I understand your question correctly I think you need to right click on "Web References" in your solution explorer and click "Add Web Reference..." You can then type in the URL of the site and it'll be added to your project just like any other library.

Related

ASP.NET Precompile with non updateable UI

I want to compile my ASP.NET web forms project into one single dll (which I think is possible) and copy that to the hosting server. As I want to protect all of my code.
In the solution explorer, if I right click the project and go to publish there are various options which I have played around with to precompile the site. The best result I have got so far is precompiled c# code and aspx pages. Unfortunately all of the javascript is still in its normal state.
I think I need to use the Merge all outputs into a single assembly option, but this unfortunately throws the errors: Target GenerateAssemblyInfoFromExistingAssembleInfo Failed
and #(_AspNetCompile_AssemblyInfo_Count) have 0 item(s) in the collection. It should only have 1 item(s)
I've tried looking in the msdn docs for information on how to best do this, and there is some information relating to the command line, but I couldn't quite follow it.
I'm using .net 4.5 & visual studio express for web 2013.
If anyone can point me in the direction of a tutorial, or just give me some help. It would be greatly appreciated.
Thanks
Jim

Is it possible to restore the source code (Models, Controllers) of an application, from the files on the website (when Publish has been used)

I have been working on a MVC 3 application on my laptop, which now has crashed. I have uploaded the newest edition of the site through the "Publish" method in VS2010. Is it possible to retrive the source code of the application? Because i cant see the Models or Controllers on the FTP.
Thanks
I have used a decompiler before to get back source code from a compiled website.
It doesnt give you the files all nicely ready to start developing again, it is a bit pain staking going through the decompiler and getting all the code you need out. But it can be done.
I cant remember which one i used, im sure a quick google will give you loads to choose from. I think there might even be one shipped with vs.

I have an ASP.net form on a website. I need to edit its actions based on the user selections, and make the radio button list allow multiple choices

I have an ASP.net form on a website. I need to edit its actions based on the user selections, and make the radio button list allow multiple choices.
I have the compiled web application, all passwords and access, all files from the original build (I believe), Visual Studio 2010, and no idea what I'm doing.
The engineer who originally built the site has moved to India, and is no longer available.
I need to load this website as a project in Visual Studio. I need to find the form files. I need to edit the options, and the actions they produce.
Even pointing me in the direction of a way to learn what I need to know will help. If you need more information, tell me what you need.
Thanks in advance for your help.
You'll need the original source files (it sounds like you have them). If it is a Web Site Project, then in Visual Studio you can do File -> Open -> WebSite and pick the directory containing those files; if it is a Web Application Project, then there should be a .csproj or a .vbproj file to open.
In order to allow the user to make multiple selections, you should use a checkbox list instead of radio buttons.
You can probably find more about ASP.NET on http://www.asp.net/get-started (I'd guess for your project that http://www.asp.net/web-forms is the first step to take).

How to place aspx-files in seperate Web Application Projects in one solution?

We have been building ASP.Net websites for many years. During this time we gathered a lot of knowledge of ASP.Net. We know what to use, a what not. One problem is still, persistently, bugging us. I hope to solve this for once and for all.
We have a fairly large solution with lots of aspx-files. All aspx-files reside in one Web Application Project. This single big WAP needs to be split in multiple smaller projects. The exact reasoning is beside the point, please believe me ;-).
There are a number of ways to accomplish this, but I am still unsure what the best way would be. We use ASP.Net 4.0 and Visual Studio 2010 Premium.
Any advice is greatly appreciated.
This is our current work-around (which we do not like)
Create a WAP (Runner).
Create a second WAP (ProjectA)
Create a third WAP (ProjectB)
Delete the web.config's in ProjectA and ProjectB
Create a simple aspx-file in Runner, ProjectA and ProjectB with a hello world message
Remove ProjectA and ProjectB
Go to Windows Explorer
Move the folders ProjectA and ProjectB inside the folder Runner
Go back to Visual Studio
Add Existing Project to solution (ProjectA and ProjectB)
Hit F5
Navigate to http://localhost:4867/WebForm1.aspx
Navigate to http://localhost:4867/ProjectA/WebForm1.aspx
Navigate to http://localhost:4867/ProjectB/WebForm1.aspx
Tada! The above works, but it feels like a hack and it smells awful. Is there a better way?
Here is what Scott Guthrie says on this. I think the second method is a superset of your procedure. In my opinion you are right: This is a hack - but the official one.
I suggest creating a new solution, and creating your required new empty web application projects under it. Then, manually copy your files from their original locations into the proper new folders which were created when you created the empty projects. After all the files are in place, go back to VS. Set Solution Explorer to 'Show All Files'. Select the the files you need in each project, right click, and select 'Include in Project'.
The only wrinkle I can think of is that creating all web applications will mean you have a web.config file in each. If this is what you need, then fine. Otherwise, you create some of the projects as class libraries.

Is it possible to suppress the Web Forms Designer in Visual Studio from being opened?

The primary reason for asking how to do this is because I personally never use it. The Designer is slow to load... especially on complex pages with lots of controls. To put it bluntly, I think of it as a crutch that web developers should avoid.
I would like to encourage team members to avoid using it as well. If there is a way to do this through a policy setting (either in TFS or otherwise) or some options when installing Visual Studio that would be even better.
Go to
Tools Menu
-> Options
-> HTML Designer
The first groupbox is "Start pages in". Setting it to Source View should accomplish what you are looking for within VS.
Thank you for all the helpful answers. What I ended up doing was setting the default view from Tools -> Options -> HTML Designer - Start Pages In = Source View (as suggested by #blu). Then I exported my Visual Studio settings to a file. The snippet below is an abstract of the relevant section. This can be saved as a .vssetings file and imported by team members as part of our standard setup:
<UserSettings>
<ApplicationIdentity version="9.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="TextEditor" RegisteredName="TextEditor">
<ToolsOptionsSubCategory name="HTML Specific" RegisteredName="HTML Specific" PackageName="Visual Studio HTM Editor Package">
<PropertyValue name="StartPageView">1</PropertyValue>
</ToolsOptionsSubCategory>
</ToolsOptionsCategory>
</ToolsOptions>
</UserSettings>
It's a per-user setting, by right clicking on the .CS file for the form and saying "Open With...", then changing the default editor for that type.
AFAIK, there is no way to force that setting via TFS.
There is no way to suppress the Editor directly, as it is part of Visual Studio. The Visual Studio 2008 is a much improved editor, as it is the same one used in Expression Web and I often use it. Also the source view is part of the Editor from what I remember.
There is an option in VS Settings to always open ASPX pages in Source View however:
Tools
Options
Web Browser
View source in
You can also specify an external editor. There is no way to suppress the designer using TFS or a GPO however.
I think so. In the Solution Explorer, right-click the an aspx or ascx file and choose Open With. When you choose the editor you want you can set it as default.

Resources