Hi,
This was the problem happening when I was developing an ASP.Net application with Windows Authentication. Well I googled it a bit. Then I found the following article in Code Project. This was exactly what I needed. Wonderful Article and clearly solves my problem.
http://www.codeproject.com/KB/aspnet/Custon401Page.aspx
I hope it helps you too :)
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
Monday, November 14, 2011
Friday, November 11, 2011
Javascript with ASP.Net : Use Javascript to iterate through a gridview and find checkbox in each row
I was looking for a mechanism to iterate over a gridview using Javascript. I had to get the checkbox in each row and update that checkbox's checked status according to the corresponding header columns checkbox's status.
Just after googling a little bit , I found exactly what I was looking for. The following link has done the same thing. Have a look at this:
http://www.codeproject.com/KB/grid/GridCheckBox.aspx
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
Just after googling a little bit , I found exactly what I was looking for. The following link has done the same thing. Have a look at this:
http://www.codeproject.com/KB/grid/GridCheckBox.aspx
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
Monday, August 29, 2011
ASP.NET: Automatically convert http urls into https url
Sometimes we need to navigate securely within the website because of some confidential information. The user might use just http but we need to change it into https. So the approach I like best is to do it in masterpage level. We can write a small code snippet in the page load section of the masterpage which checks if the page is http or not. If it is http then changes it to https. Following are the line of codes that we need to put in the master page's page load function. I did not come up with these code, I collected it from the internet. So I am not taking any credit for the code ;)
//Redirect to https if typed http.
string redirectUrl = null;
HttpContext context = HttpContext.Current;
// if we want HTTPS and it is currently HTTP
if (!context.Request.IsSecureConnection)
{
redirectUrl = context.Request.Url.ToString().Replace("http:", "https:");
}
// check if we need to redirect, and if so use redirectUrl to do the job
if (redirectUrl != null)
context.Response.Redirect(redirectUrl);
Hope it helps. :)
//Redirect to https if typed http.
string redirectUrl = null;
HttpContext context = HttpContext.Current;
// if we want HTTPS and it is currently HTTP
if (!context.Request.IsSecureConnection)
{
redirectUrl = context.Request.Url.ToString().Replace("http:", "https:");
}
// check if we need to redirect, and if so use redirectUrl to do the job
if (redirectUrl != null)
context.Response.Redirect(redirectUrl);
Hope it helps. :)
Thursday, August 25, 2011
ASP.NET: How to create a custom error page.
ASP.NET has this useful feature that you can set a custom error page. Whenever an error occurs in the system, you are automatically redirected to the custom error page. By using this feature you can avoid showing the ugly yellow page and the error details to the user. How to implement this? Well the following link has described it all in details. :)
http://www.asp.net/hosting/tutorials/displaying-a-custom-error-page-cs
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
http://www.asp.net/hosting/tutorials/displaying-a-custom-error-page-cs
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
Wednesday, August 10, 2011
ASP.NET: How to save the result found from database query in an excel file and let the user download that file
I was exactly looking for this solution and found that msdn already has what I needed (as usual). Here is the link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;311194
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
http://support.microsoft.com/default.aspx?scid=kb;en-us;311194
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
Wednesday, August 3, 2011
ASP.NET: Adding check/uncheck all button with a gridview.
It is a common question for many developers that
1) How to add a checkbox that appears with each row of a gridview.
2) How to implement check/uncheck all functionality.
I found a useful tutorial on the internet which pretty much covers both of the above questions.
Take a look at this here:
http://wiki.asp.net/page.aspx/281/check-uncheck-checkboxes-in-gridview-using-javascript/
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
1) How to add a checkbox that appears with each row of a gridview.
2) How to implement check/uncheck all functionality.
I found a useful tutorial on the internet which pretty much covers both of the above questions.
Take a look at this here:
http://wiki.asp.net/page.aspx/281/check-uncheck-checkboxes-in-gridview-using-javascript/
** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**
Labels:
ASP.net,
check all,
checkbox,
gridview,
uncheck all
Monday, July 18, 2011
ASP.NET : How to access/read value from any control within a repeater.
We often need to read values from a databound control inside a repeater. How to read the control?
This is very simple. The following code sample has all in it. We assume that the repeater variable is repeaterObj and the control we want to access has the id "controlId". The control resides under itemtemplate. Then the code will be:
repeaterObj.ItemTemplate.Items[0].findControl("controlId");
To read the value from a label use :
string labelText = repeaterObj.ItemTemplate.Items[0].findControl("controlId").Text;
This is very simple. The following code sample has all in it. We assume that the repeater variable is repeaterObj and the control we want to access has the id "controlId". The control resides under itemtemplate. Then the code will be:
repeaterObj.ItemTemplate.Items[0].findControl("controlId");
To read the value from a label use :
string labelText = repeaterObj.ItemTemplate.Items[0].findControl("controlId").Text;
Subscribe to:
Posts (Atom)