While trying to create an application for one of our resellers, I realized that session data on our side is lost when they include our application in an iframe on their site. This is because on some browsers (IE mostly), when you reference cross site pages by frames, cookies are not enabled for the site you reference. As session data is dependent on cookie, you loose session state too.
To prevent this, you should add a P3P header data to your referenced page header like below. You can add this to your global.asax for your dot net application.
1
2
3
4
| protected void Application_BeginRequest(Object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
} |
ASP.Net, Programming ASP.Net, c#, session state
You have created your sign up form with full power of AJAX but when you do your trick to check for username availability via AJAX, it seems that passwords fields are reset. You can overcome this situation by setting up passwords filed values each time you make a postback.
1
| txtPassword.Attributes.Add("value", txtPassword.Text); |
That should do the trick!
ASP.Net, Programming csharp, dotnet, password field, postback
When you place an ASP.NET AJAX TabContainer in an UpdatePanel, the styles needed to show it properly may be lost. This is because UpdatePanel sometimes decides not to load required styles on PageLoad or on postbacks.
You can overcome this situation by placing an empty TabContainer outside any UpdatePanel, simply causing the browser to load all the required styles on PageLoad and use them for other TabContainers placed inside UpdatePanels.
ASP.Net, Programming
You can disable a button on the client side to prevent multiple clicks by just adding an onClick function that runs on client side. You should check if page has a client side validation script and it passes first. If so, you just disable the button and call postback event.
Here is an example for the button named “btnAddcustomer”. Just paste it into Page_Load.
1
2
| Dim strDisable As String = "if (typeof(Page_ClientValidate) == 'function') {if (Page_ClientValidate() == false) { return false; }} this.value = 'Please wait...'; this.disabled = true; " & ClientScript.GetPostBackEventReference(btnAddCustomer, "")
btnAddCustomer.Attributes.Add("onclick", strDisable) |
ASP.Net, Programming ASP.Net, disable button, postback, vb