View Single Post
  #9 (permalink)  
Old July 5th, 2011, 03:25 AM
Mahesha999 Mahesha999 is offline
Authorized User
Points: 51, Level: 1
Points: 51, Level: 1 Points: 51, Level: 1 Points: 51, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2011
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts

JavaScript is working
This is the modified Page1.aspx to include an additional button that runs the JavaScript

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Page1.aspx.cs" Inherits="Page1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <script language="javascript" type="text/javascript">
// <![CDATA[

        function Button3_onclick() {
            alert("This is to test if the JavaScript works or not.");

// ]]>
    <form id="form1" runat="server">
        Enter your name:<br />
        <asp:Textbox ID="TextBox1" Runat="server"></asp:Textbox>
            When do you want to fly?<br />
            <asp:Calendar ID="Calendar1" Runat="server"></asp:Calendar></p>
            <br />
            <asp:Button ID="Button1" Runat="server" Text="Submit page to itself" OnClick="Button1_Click" />
            <asp:Button ID="Button2" Runat="server" Text="Submit page to Page2.aspx" PostBackUrl="~/Page2.aspx" />
            <input id="Button3" type="button" value="Run JavaScript" onclick="return Button3_onclick()" />
        <asp:Label ID="Label1" Runat="server"></asp:Label></p>
Output Printscreen:

In the browser's html source window, the axd file's url seems something like this:

<script src="/PostBackUrl/WebResource.axd?d=yXPd-6jqJU9yUpgUop_GXLe959_q_LG_ul4NaiPWx5aj8oORGZE2cl-TVJKxf2ByJM96bXDpnwEuvNuyiPa56bnJZ75zvzulLnpDXuabk481&amp;t=634589204126647261" type="text/javascript"></script>
But when tried to request the file directly, following error occured:

I googled for the same.
many people had this problem (about the postback, not specific to the axd file), they found different solutions that did not worked for me.

merk (third post) talked about the axd file problem at But did not explained how solved it to the length:

Last edited by Mahesha999; July 5th, 2011 at 03:28 AM.. Reason: edit