ASP.NET common controls source code - asp.net

Is there a source code readily available for commonly used controls (say found in the toolbox) for ASP.NET 2.0?
The level of detail that I want its that I need to know the internal workings of the control.

Yes, Microsoft has actually released the Source code for the System.Web assembly, amongst others.
It is intended to make it possible to debug the built-in classes, so you as a developer have a better chance of understanding why a specific class behaves as it does. You can make Visual Studio download the source on-the-fly, when you try to step-in to a function with the debugger.
http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx
If you would like to read / browse the source code; you can also download it all using the NetMassDownloader project from CodePlex.

ASP.NET QuickStart Tutorials best fit for your needs.
Here you can access : Standart Toolbox Control Tutorials
EDIT : You edited your post to get resource for inner workings of server components.
Here is my another suggestion : Nikhil Kothari's Developing Microsoft ASP.NET Server Controls and Components is the best resource on components and inner workings.
alt text http://ecx.images-amazon.com/images/I/41AQGWDEYAL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA240_SH20_OU01_.jpg

The quick way to look at the source code of controls or any other class libraries is to use disassembler, for example .NET Reflector link text

They are all documented on MSDN. Get started at the ASP.NET Developer Center, and at http://asp.net.

Related

How do I package ASP.Net User Controls (ascx) into a DLL for sharing across projects?

I'm working on an straight ASP.Net application. (no additional frameworks).
I've got several user controls (not custom controls) which I'd like to be able to package into a DLL for reuse/redistribution across several other applications. Ideally, we'd like to have everything self contained in (.ascx and source files) a DLL which could be added to the target project's references.
When embedding the user controls into .aspx pages, we'd like to be able see those controls in Visual Studio design view.
I've been looking around and seen several possible solutions for this.
Can anyone point me to a clear tutorial/example which will help step me through this process?
John, as far as I am aware, what you are asking is not possible, at least not out of the box with the .net Framework. When you build a UserControl in ASP .NET app and compile the solution, as you may have realized, the UserControl would be included in the dll of the project to which it belongs; it won't have a separate dll of its own. Since the UserControl won't have a dll of its own, you won't be able to make it available in the design view/toolbox.
For what you are asking, you might want to consider creating ServerControls instead. Server controls are harder to create than UserControl, if I recall correctly, you have to code it entirely, wont have designer available, but when you are done and compile, ServerControl will have it's own dll, which could be made available in CustomControls under Toolbox.
If you want a starting point for ServerControl, I would highly recommend watching the video from KudVenkat. His explanation and demos are second to none.
Link to the tutorial

Connecting to an API offered by a Company

I currently have an internal system that I need to link up to an API offered by a company. I am not looking for hand-holding on this, I really need to understand where and how to get started really.
Here is the developer resource for the API I am looking to work with:
http://wiki.cdyne.com/index.php/Postal_Address_Verification
Further, my systems are currently in ASP/ASP.NET & SQL, and I'm familiar with VB so I would rather stay that direction instead of C#.
Can I get some direction on how to tackle this? Thanks a lot for the help!
The easy way is to add a Service Reference in your project. Right-click the project in Solution Explorer and choose "Add Service Reference...". Copy the WSDL URL (from the documentation page you linked) into the address box and click Go. More: http://msdn.microsoft.com/en-us/library/bb628652%28v=VS.90%29.aspx
Use "WCFpav" as the Namespace to match the examples.
You should be able to use the C# example, just change the syntax for VB.Net (or use a converter, but it's a simple exercise).
Note: the Add Service Reference wizard is available in VS2008 and VS2010.

Where can I find a clean API for Visual Basic development?

I am completely new to ASP.NET programming, and was asked to work on a small project involving ASP.NET, VB (which I am new to as well) and Microsoft SQL Server 2005.
Being used to php/java I was hoping to find some kind of similar API to php.net and the javadoc. It would be very useful to have as I would prefer to work with a text editor, instead of using DreamWeaver or Visual Web Developer.
In the project I basically only need to use ASP.NET to read from a SQL 2005 database and write to JSON files. Could anyone please give me some pointers on where to find a clean and decent API to work with? I would also appreciate any input and tips I could get to get started working on this.
I would prefer to work with a text editor, instead of using DreamWeaver or Visual Web Developer.
Imo this is a mistake in .Net. The platform was built with the IDE in mind. You really will be able to get a lot more done, and do it better, if you let yourself learn to use Visual Studio.
That said, the place to look for .Net documentation is, of course, the MSDN Library. Maybe start on this page:
http://msdn.microsoft.com/en-us/library/w0x726c2.aspx
only need to use ASP.NET to read from a SQL 2005 database and write to JSON files
You might want to take a look at ASP.NET MVC.
You controllers can return a JsonReasult which will automatically result in JSON being sent. No need to define any markup.
"Could anyone please give me some
pointers on where to find a clean and
decent API to work with?"
If you want to develop a VB.NET application, you have to use the VB.NET programming language; there are no other APIs available.
Where does javadoc fit into this? That's just markup you apply to your source code to create documentation. .NET has its own system which works in the same way but is built on XML.
As Joel says, Visual Studio has everything you need. It features a visual editor but also gives you access to all the source code.
you will need to have the IDE to develop ASP.Net application. It will be much easier using it. You can find docs and articles on developing on ASP.Net in this site. its a nice one.
https://web.archive.org/web/20211027112438/https://aspnet.4guysfromrolla.com/default.aspx#Tools2
https://web.archive.org/web/20210513213529/http://aspnet.4guysfromrolla.com/articles/042705-1.aspx
https://web.archive.org/web/20210802161558/https://aspnet.4guysfromrolla.com/articles/110905-1.aspx
work on a small project involving ASP.NET, VB (which I am new to as well) and Microsoft SQL Server 2005
It might not be VB, it might be VB.Net?

Ajax on Mono

Do you guys know about an ajax toolkit (or something similar to the m$-ajaxtoolkit) for mono??
Microsoft's ASP.NET AJAX Control Toolkit works on Mono, and is open source (Ms-PL). That doesn't preclude the use of jQuery, though. There are actually several third party AJAX libraries and control toolkits that support Mono, and many are compatible or work in conjunction with ASP.NET AJAX.
I agree with Brian, but want to add that you should read Dave Ward's series on jQuery and ASP.net. He really distills the essence of what you can do with jQuery, PageMethods, and WebForms without MS Ajax. These ideas are directly applicable to the Mono / Linux environment.
Here's a list of essential posts:
Using jQuery to directly call ASP.Net Ajax PageMethods
Use FireBug To Learn jQuery
Simplify calling ASP.NET Services with jQuery
I'd recommend rolling your own using jQuery. That's what m$ is doing now anyway.
Debugging Mono website
Do you remember, that you have no development environment in this machine? You can install it, or download Mono liveCD with openSuse. But before doing it, please note, that GTK# (it’s devenv) is not very user friendly. It even worse, then Eclipse. So let’s try to understand first whether we can fix small compatibility problems without entering code.
The most convenient method to debug web site on Mono is by using XSP and XSP2 mini web servers. Just enter the directory of the site and run it. By default you’ll be able to access the site by using ... (it also be written for you). Enter and notice whether you have any errors in console. No? Keep doing
The most common problem is “error 500” with nonsense stack. If it contains ScriptManager error Type not found, the problem is in Web.config file. Try to regenerate it to be compatible to Mono (for example, Mono has different version of System.Web.Extensions assembly. In ASP.NET 3.5 it has version 3.5, Mono has only 1.0.61025.0 (the old AJAX.NET). To recreate your web.config all you have to do is to execute “mconfig af AJAX Web.config” It will create default web.config file, supports System.Web.Extensions (AJAX features).
Not helped? Keep doing. Let’s look another time into the stack – if it contains errors in “EnablePageMethods” or “ShouldGenerateScript” or “EncryptString” – the problem is serialization. Mono has very limited support for JSON, XML and SOAP serialization. Try to look into your code and notice if you have classes, marked with [Serializable] or you are transferring your own classes by using PageMethods. If so, replace it with regular strings (my grandma serialization).

ASP.NET Membership: Login Controls Source Code

Is the source code for the common login controls available?
Those are the controls which are available under Login section in Toolbox:
Login,
LoginView,
PasswordRecovery,
LoginStatus,
LoginName,
CreateUserWizard,
ChangePassword
Eventually could you point me to a good source of custom implementation of functionality that those controls provide, or some guidance on implementing this functionality without using the mentioned controls.
I am using Visual Studio 2005 (.net2)
I will be using SQLMembershipProvider as the MembershipProvider but that probably should make no difference.
"the entire framework is available" is not true. :)
The source code for the entire framework is available. The link below provides some details as to how to access:
http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx
I am going to give this a qualified "NO".
I have gone down the road of implementing an implementation of the Login server control using reflected source as a starting point (this was before symbol server integration).
Things seem to go swimmingly, with a few reflection hacks to get to core framework members that obviate reams of code.
Until you get to the designers. That infrastructure is a minefield and gets wide and deep with a quickness and is filled with even deeper buried internal types that need implementations or reflection hacks.
Ultimately wound up with a working control that I could extend but would never want to maintain.
The effort was not wasted; I learned a lot about how over engineered server controls are designed.
And then I just shifted a login control to template mode and got everything I needed to get done in a few lines of code. ;-)
Except as a learning experience I would certainly recommend against going down that road.
Good luck.

Resources