Posts

Showing posts from March, 2010

Request format is unrecognized for URL unexpectedly ending in

Today I want to share with you a new problem which I had faced yesterday.
Problem:
It was about web service related error. I have used Web Method() in my application to fill up a country dropdown. Everything was going well but when I had used this web method it showed me an error like this:

System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetCountyList'.

Information:
After googling, I have found the solution.
This error was occured because GET and POST are disabled by default in ASP.NET 2.0 and greater.Now I would like to share this with you. From msdn I have got some relative information which may help you to get understand clearly.

The .NET-connected Web services support HTTP GET, HTTP POST and SOAP protocols. By default, in .NET Framework 1.0, all three protocols are enabled. By default, in .NET Framework 1.1 or greater, HTTP GET and HTTP POST are both disabled. This is for security reasons.

Applications that use HTTP GET or HT…

How to show Page loading progress with modal background

Problem:
In my recent application development I have faced a strange problem to show modal background with page loading progress. I had tried in different way but not working perfectly. Then I have solved it. I think that there is another efficient way to solved it but now this time it is working for me.

Solution:

In css class:
.divModalBackground
{
filter: alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5;
width:100%;
background-color: #999988;
position: absolute;
top: 0px;
left: 0px;
z-index: 800;
}

In aspx page:
<asp:Panel ID="Panel1" runat="server" Height="900px" Width="100%" CssClass="divModalBackground" Visible="true" >
<asp:Image runat="Server" ID="ImageLoader" CssClass="LoadingProgress" ImageUrl="../../App_Themes/Black/images/ajax-loader.gif" />
</asp:Panel>


In aspx.cs page I put the code like this:
//to show modal popup at page startup
protected override void O…

Prevent Duplicate record insertion on page refresh in asp.net

Problem:
Today I have faced a new problem(new for me), when I press save button it works fine and then refresh(F5 or Refresh button on browser) the page but this time it is execute the button click event again. For this duplicate data posting on the server.

I try to find out the problem, nothing wrong in my code. Now turn to google and figure out the problem with solution. I have got several solutions. Now I would like to share this solution which solved my problem ......

Solution:

Assume that in Test.aspx page you have a button and a TextBox:
<asp:Button ID="btnSubmit" runat="server" Text="Submit" Width="110px" OnClick="btnSubmit_Click" />
<asp:TextBox ID="TxtName" runat="server"></asp:TextBox>
In Test.aspx.cs..:
public partial class Test : System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
btnSubmit.Click += new EventHandler(btnSubmit_Click);base.OnInit(e);
}
protected void Page_Load(o…