1. Set the
2. use the reg_sql to generate the SQL tables for use with SQLMembership Provider.
3. Add
5. Methods include:Createuser, ValidateUser, DeleteUser, FinduserByName,finduserByEmail,GenPassword
6.Options to capture other user info with ProfileSystem, and defining provider properties in webconfig. Or simply adding additional tables.
Posts in category ASP.NET
Notes on SQLMembership Provider using the MembershipProvider Class
Table to Excel XLS code
Dim StringWriter1 As IO.StringWriter
Dim StringBuilder1 As StringBuilder = New StringBuilder
StringWriter1 = New IO.StringWriter(StringBuilder1)
Dim TextWriter1 As HtmlTextWriter = New HtmlTextWriter(oStringWriter)
label.RenderControl(oTextWriter)
Response.Clear()
Response.ClearHeaders()
Response.ContentType = “application/vnd.xls”
Response.AddHeader(“Content-Disposition”, “attachment;filename=WLMS-exlfile.xls”)
Response.Write(StringWriter1.ToString())
Response.Flush()
Response.End()
Setting the SelectedValue of RadioButtonList & DropDownList in GridView EditItemTemplate
Here is a trick one, because IntelliSense doesn’t bring up the “SelectedValue” property for a RadioButtonList, or a DropDownList in an EditItemTemplate for GridViews you may forget that “SelectedValue” is an actual property of these controls.
Here is how you can set the selected value of a RadioButtonList inside an EditItemTemplate
<asp:TemplateField HeaderText="Payment">
<ItemTemplate>
<asp:Label ID="lablePayment" runat="server" Text='<%#Eval("PayName")%>' />
</ItemTemplate>
<EditItemTemplate>
<asp:RadioButtonList Runat = "server" ID="rblPaymentType" SelectedValue='<%#Eval("PayTypeID")%>'>
<asp:ListItem Text="Check" Value="1"></asp:ListItem>
<asp:ListItem Text="Credit Card" Value="2"></asp:ListItem>
</asp:RadioButtonList>
</EditItemTemplate>
</asp:TemplateField>Conditional Hyperlink in template
<%
#IIf((Eval(“id”) Is System.DBNull.Value), Eval(“Last”) & “, “ & Eval(“First”), “<a href=” ../default.aspx?id=” & Eval(“id”) & “>” & Eval(“Last”) & “, “ & Eval(“First”) & “</a>”)%>
WebMethods For Use With Visual Studio and AJAX
The webmethod tag is an attribute added to a Public methods to indicate the method should be exposed as part of an XML Web service. Below is an example of applying the WebMethod attribute.
<WebMethod()> _
Public Shared Function FunctionName(ByVal Parameter As String) As ObjectName
Dim ObjectName As Object = Object
Return ObjectName
End Function
The Web method can now be called via javascript on the client. Below is an example of calling the webmethod from the client.
PageMethods.FunctionName(Parameter1, onComplete, OnTimeOut, onError);
Here is a great link with additional information for web methods:
http://www.novologies.com/post/2009/05/06/Cleaner-Faster-Ajax-in-ASPNET.aspx
Microsoft Project Code Name “Velocity”
Microsoft Velocity provides distributed in-memory web application caching. This provides highly scalable, high-performance application caching. “Velocity Caching” can be used to cache any Common Language Runtime (CLR is the Virtual Machine of Microsoft’s .NET initiative) through simple API’s. From a general standpoint, Velocity was created with the goal of providing performance, scalability and availability.
The main application for providing scalable, available, high-performance applications using Velocity is by fusing the memory between multiple computers to give a single/unified cache view for the application to employ. The application can they store any CLR object that is serializable.
A better way to get a querystring
If (Not String.IsNullOrEmpty(Request.QueryString("qString"))) Then qString = Request.QueryString("qString")
End if
Software Development: Patterns And Practices
http://msdn.microsoft.com/en-us/practices/default.aspx
http://msdn.microsoft.com/en-us/library/cc467894.aspx
http://www.codeplex.com/AppArchGuide
According to Microsoft P&P (Patterns and Practices) were created to meet the demands of architects and application developers. By following proven patterns and practices it is suggested that more sound applications will be the result. Included in P&P
- How to design
- Develop
- Deploy
- Operate architecturally sound applications on a Microsoft platform.
P&P for Web Applications
http://msdn.microsoft.com/en-us/practices/bb969054.aspx#web_apps
PHP Patterns and Practices
http://www.phppatterns.com/docs/start
ASP.NET Page and Application Tracing
Tracing
The tracing feature in ASP.NET is useful in tracking the execution of an application. This is helpful to display the trace in a way that doesn’t affect the programs output.
To enable tracing on a page-by-page level, set the Page directive in any ASP.NET page to True:
<%@ Page Language=”C#” Trace=”true” TraceMode = “SortByCategory” Inherits = “System.Web.UI.Page” CodeFile=”Default.aspx.cs” %>
To enable tracing for an entire application add tracing settings to the web.config:
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug=”false” />
<authentication mode=”Windows” />
<trace enabled =”true” pageOutput =”True” requestLimit =”20″ traceMode =”SortByTime ” />
</system.web>
</configuration>
The page-level setting will take precedence over the web.config setting.
How to view Trace Data.
In the Page_Load event call System.Diagnostics.Trace.Write(). Make sure the pageOutput=True in the webConfig.
What’s being displayed
1. Request Details
ASP.NET Session ID, Character encoding of the request.
2. Trace information
All Trace.write methods called in the HTTP request. This is helpful to find methods that are taking a long time to execute.
3. Control Tree
HTML of ASP.NET Control Tree.
4. Session State
List all keys and values for users session .
5. Application State
List all keys and values for application.
6. Request Cookies Collection
List all cookies passed in during page request.
7. Response Cookies Collection
List all cookies passed back during page response.
8. Headers Collection
Shows all headers passed in during request from browser.
9. Response Headers Collection
Shows all headers passed back during response.
10. Form Collection
Displays dump of Form Collection and all keys and values.
11. Querystring Collection
Displays dump of Querystring collection and all keys and values.
12. Server Variables
Displays dump of Server Variables with keys and values.
The Trace.axd
Page output only displays information of the current page. If you want to create a collection use Trace.axd.
http://localhost/application-name/trace.axd
Trace.axd will display all tracing data up to the present limit.
Trace Forwarding
ASP.NET allows to forward trace message to System.Diagnostics.Trace:write to DiagnosticsTrace
<trace enabled =”true” requestLimit =”20″ writeToDiagnosticsTrace =”true ” pageOutput =”true”/>


