Ever gotten an error when you click submit when you enter some HTML in your form? Want users to be able to submit HTML tags? Not only is it possible, it’s easy! Somewhere in your page directive on your .aspx page, simply include the attribute: validateRequest=”False”.
Yeah, that’s it.
WARNING: doing this means that the .NET engine will not check for possibly harmful code a user could enter via HTML or Javascript, so make sure you know what you’re getting into before you turn off this feature.
13 Temmuz 2007 Cuma
ELMAH - Google Code
I have blogged in the past about using ELMAH (Error Logging Modules and Handlers) for error logging in my ASP.NET applications. I still use it and love it, still one of the best tools out there.
The project has moved from GotDotNet, which Microsoft abandoned in favor of CodePlex, to Google Code. You can find it here - elmah - Google Code
The project has moved from GotDotNet, which Microsoft abandoned in favor of CodePlex, to Google Code. You can find it here - elmah - Google Code
Exporting Datagrid OutPut To EXCEL
The following code can be used to export datagrid output to EXCEL format
Response.Clear();
Response.AddHeader(”content-disposition”, “attachment;filename=filename.xls”);
Response.Charset = “”;
Response.ContentType = “application/excel”;
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataGrid1.RenderControl(htmlWrite);
System.Web.HttpContext.Current.Response.Write(stringWrite.ToString());
System.Web.HttpContext.Current.Response.End();
Response.Clear();
Response.AddHeader(”content-disposition”, “attachment;filename=filename.xls”);
Response.Charset = “”;
Response.ContentType = “application/excel”;
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataGrid1.RenderControl(htmlWrite);
System.Web.HttpContext.Current.Response.Write(stringWrite.ToString());
System.Web.HttpContext.Current.Response.End();
DataGrid or GridView Paging
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
GetData()
End Sub
Private Sub GetData()
Dim ds As New DataSet()
ds.ReadXml(Server.MapPath(”.”) & “\..\Xml\PartList.xml”)
Me.GridView1.DataSource = ds.Tables(0).DefaultView
Me.GridView1.DataBind()
ds.Clear()
ds.Dispose()
g = Nothing
‘Me.Dispose()
End Sub
GridView1.PageIndex = e.NewPageIndex
GetData()
End Sub
Private Sub GetData()
Dim ds As New DataSet()
ds.ReadXml(Server.MapPath(”.”) & “\..\Xml\PartList.xml”)
Me.GridView1.DataSource = ds.Tables(0).DefaultView
Me.GridView1.DataBind()
ds.Clear()
ds.Dispose()
g = Nothing
‘Me.Dispose()
End Sub
Adding item to Databoud Drop Down control
It was quite a struggle for me to add a string “All” to a data bound drop down list box. It was really becoming for me a challenge as everytime my client would bring this point and when I tell my problem he would give some stupid way to solve this issue. So atlast taken this challenge.
Suppose you have drop down list box, and you have SqlDataSource to bound it some data. In my case I was trying to populate with some user list. Now there was an option for All which I have to add initially I added a checkbox next to the dropdown but then I got a way to do it googling. The solution is to use the Insert method to add an list item to the drop down
ListItem item = new ListItem(”All”, “All”);
cmbUseList.Items.Insert(0,item); //The first is the index
Thanks to the customer who challenged to bring the good solutions.
Suppose you have drop down list box, and you have SqlDataSource to bound it some data. In my case I was trying to populate with some user list. Now there was an option for All which I have to add initially I added a checkbox next to the dropdown but then I got a way to do it googling. The solution is to use the Insert method to add an list item to the drop down
ListItem item = new ListItem(”All”, “All”);
cmbUseList.Items.Insert(0,item); //The first is the index
Thanks to the customer who challenged to bring the good solutions.
Introducing MS ASP.NET AJAX (Pro - Developer)
AUTHOR : by Dino Esposito (Author)
PUBLISHER : MS Press publisher
PUB DATE : May 09, 2007LANGUAGE : EnglishRLS
DATE : 06/28/2007FORMAT : CHM
Get an expert introduction to the new JavaScript enhancements (code-named “Atlas”) for Microsoft ASP.NET 2.0. More than a basic AJAX (Asynchronous JavaScript And XML) script library, the Microsoft implementation brings object orientation to JavaScript, together with enhanced client-side and server-side controls that greatly simplify coding while delivering enhanced Web experiences with any browser. Scheduled for release with the next version of Microsoft Visual Studio®, code named “Orcas,” AJAX extensions and tools can be used by developers today. This book offers expert insights direct from the Microsoft product team and noted ASP authority Dino Esposito, as well as hands-on instruction and examples of Web development with AJAX. This ideal reference will be updated online, keeping readers up to date with the evolving tool. The book includes code samples in ASP.NET 2.0 created using C# and JavaScript.
Key Book Benefits:-Provides coverage of both client-side and server-side development-Covers ASP.NET AJAX 1.0, as released in January 2007-Features Online Product Extensions for updated code samples during the continuing development process
Download:http://rapidshare.com/files/41072441/Microsoft.Press.Introducing.Microsoft.ASP.NET.AJAX.May.2007.chm
PUBLISHER : MS Press publisher
PUB DATE : May 09, 2007LANGUAGE : EnglishRLS
DATE : 06/28/2007FORMAT : CHM
Get an expert introduction to the new JavaScript enhancements (code-named “Atlas”) for Microsoft ASP.NET 2.0. More than a basic AJAX (Asynchronous JavaScript And XML) script library, the Microsoft implementation brings object orientation to JavaScript, together with enhanced client-side and server-side controls that greatly simplify coding while delivering enhanced Web experiences with any browser. Scheduled for release with the next version of Microsoft Visual Studio®, code named “Orcas,” AJAX extensions and tools can be used by developers today. This book offers expert insights direct from the Microsoft product team and noted ASP authority Dino Esposito, as well as hands-on instruction and examples of Web development with AJAX. This ideal reference will be updated online, keeping readers up to date with the evolving tool. The book includes code samples in ASP.NET 2.0 created using C# and JavaScript.
Key Book Benefits:-Provides coverage of both client-side and server-side development-Covers ASP.NET AJAX 1.0, as released in January 2007-Features Online Product Extensions for updated code samples during the continuing development process
Download:http://rapidshare.com/files/41072441/Microsoft.Press.Introducing.Microsoft.ASP.NET.AJAX.May.2007.chm
Error al ejecutar aplicación ASP.NET con IIS 6.0
A veces pasa que llevamos mucho tiempo trabajando en una aplicación y que desde Visual Studio se ve de fábula. Una vez acabada la publicamos, ponemos los archivos en el directorio C:\Inetpub\wwwroot\ , abrimos el navegador, escribimos localhost en la barra de direcciones y…. TACHÁN!!! ERROR!!! El mundo abajo…. veamos hoy el típico error : App-Domain could not be created.
El error que muestra es:
“Failed to execute request because the App-Domain could not be created. Error: 0×80131902″ . (Nota: El número de error puede variar…)
Esto ocurre la primera vez que inicias una aplicación en el IIS con el framework 2.0 . No se exactamente porque (posiblemente sea por el orden de instalación del IIS y el framework 2.0) pero la solución es la siguiente:
Ve a Inicio-Ejecutar y allí escribe cmd (abrir una ventana de comandos de Windows).
Dirígete al path donde tengas instalado el framework 2.0, si lo tienes por defecto seguramente será: C:\Windows\Microsoft.Net\Framework\v2.0.50727\ .
Una vez allí escribe: net stop w3svc para parar los servicios web.
Luego escribe aspnet_regiis.exe -i para instalar ASP.NET en el IIS.
Y finalmente reinicias los servicios de web: net start w3svc .
Una vez hecho esto prueba a ejecutar la aplicación. Si está todo correcto funcionará.
El error que muestra es:
“Failed to execute request because the App-Domain could not be created. Error: 0×80131902″ . (Nota: El número de error puede variar…)
Esto ocurre la primera vez que inicias una aplicación en el IIS con el framework 2.0 . No se exactamente porque (posiblemente sea por el orden de instalación del IIS y el framework 2.0) pero la solución es la siguiente:
Ve a Inicio-Ejecutar y allí escribe cmd (abrir una ventana de comandos de Windows).
Dirígete al path donde tengas instalado el framework 2.0, si lo tienes por defecto seguramente será: C:\Windows\Microsoft.Net\Framework\v2.0.50727\ .
Una vez allí escribe: net stop w3svc para parar los servicios web.
Luego escribe aspnet_regiis.exe -i para instalar ASP.NET en el IIS.
Y finalmente reinicias los servicios de web: net start w3svc .
Una vez hecho esto prueba a ejecutar la aplicación. Si está todo correcto funcionará.
Kaydol:
Kayıtlar (Atom)