• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "ASP .NET and IIS 6 problem"

Collapse

  • lightng
    replied
    That makes sense. Cross-page posting (postbackurl) didn't exist in .NET 1, so there were no client scripts to do the job.

    It was a javascript problem after all!

    Leave a comment:


  • VectraMan
    replied
    Aha!

    The problem was that I hadn't associated .axd files on the server with .NET2. I guess that's an autogenerated thing because I don't have any, but I notice that returned HTML includes script from one of those. Not suprising that the script from .NET1 wouldn't work with the HTML from .NET2, though the error could have been a bit more helpful.

    Doh!

    Thanks everyone for helping. Isn't it always the way that you only spot your stupid mistake after you ask others for help?

    Leave a comment:


  • lightng
    replied
    [QUOTE=VectraMan;1086809]The problem is these image buttons are dynamically generated, and I don't seem to be able to add an OnClick in the same way that I do in .aspx.[QUOTE]

    This might help. Adding an event handler to a control...

    Code:
    img.Click+=new EventHandler(img_Click);

    Leave a comment:


  • VectraMan
    replied
    Originally posted by lightng View Post
    If you use "CommandName" and "CommandArgument" parameters for your image buttons, this will enable you to use the same event handler for your buttons and give you the ability to pass parameters.
    The problem is these image buttons are dynamically generated, and I don't seem to be able to add an OnClick in the same way that I do in .aspx.

    I've found another problem, which maybe sheds some light on the first one:

    On a different form I have a validator:

    Code:
    <asp:TextBox id="creditCardNumber" runat="server" Width="215px" />
    <asp:RequiredFieldValidator runat="server" 		            id="RequiredFieldValidator2" ControlToValidate="creditCardNumber" display="Dynamic" >!</asp:RequiredFieldValidator>
    This works fine on the local server, and if I submit without filling in the field I get a red exclamation mark. On the IIS6 server, I first get a script error: "WebForm_PostBackOptions is undefined", followed by the .NET unhandled exception page.

    It does seem the servers are doing something different. Both are running .NET 2.0.50727. Is there some other IIS6 update I need to install perhaps? Not that I can find (it it has W2003 SP1).

    Leave a comment:


  • lightng
    replied
    That is an odd problem Vectraman!

    If you use "CommandName" and "CommandArgument" parameters for your image buttons, this will enable you to use the same event handler for your buttons and give you the ability to pass parameters.

    Leave a comment:


  • VectraMan
    replied
    It ends up like this, which is right as far as I can decypher it:

    Code:
    <input type="image" name="ctl04" src="images/cartbuttons/decrease_quantity.gif" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl04&quot;, &quot;&quot;, false, &quot;&quot;, &quot;Basket.aspx?decqty=y&amp;item=1&quot;, false, false))" style="border-style:None;height:14px;width:20px;border-width:0px;" />
    I did a comparison of the code generated by the two webservers, and they're pretty much identical. Though one thing I did notice is that the action in the form is filled in.

    I have in my aspx:

    Code:
     <form id="form1" runat="server" action="Basket.aspx">
    The VS2005 server returns the same thing, whereas the IIS6 server adds the fields to the action. However taking out the action part meant they both returned all the fields, but still worked differently.

    I have another asp:button on the page which has an OnClick handler, and that works properly. So maybe I just need to work out how to do that instead.

    Could this be a caching thing? I tried setting the content expiration options on the server to immediate, but that hasn't affected anything.

    Thanks for listening.

    Leave a comment:


  • lightng
    replied
    PostBackUrl relies on javascript to change the form post action before submitting. It's a bizarre one given the facts presented so far but I would check...

    Do you get any javascript errors?
    Have you checked the page source especially around the html created for the imagebutton controls?
    Is "Basket.aspx?addqty=y&item=" + basketID evaluating to a string correctly?

    Leave a comment:


  • VectraMan
    replied
    It's an ASP table that I'm dynamically adding things to (I didn't know any other way), like this:

    Code:
    ImageButton img = new ImageButton();
    img.ImageUrl= "images/cartbuttons/increase_quantity.gif";
    img.Width = 20;
    img.Height = 14;
    img.BorderStyle = BorderStyle.None;
    c5.BackColor = Constants.clrBack;
    img.PostBackUrl = "Basket.aspx?addqty=y&item=" + basketID;
    c5.Controls.Add(img);
    (c5 is the TableCell).

    The quantities are stored in the DB, so surely it has to be handled by the server. But maybe I should be using an event rather than a PostBackURL?

    Leave a comment:


  • lightng
    replied
    Originally posted by Durbs View Post
    If the former, make sure you aren't using server.transfer as this'll render your querystring shenanigans non-functional.
    WDurbsS. Response.redirect will work but will add an unnecessary server round-trip.

    Show us the code. We could be way off mark here.

    Leave a comment:


  • Durbs
    replied
    When you say 'up button' is this a server control running an onclick event like response.redirect/server.transfer or simply an image you've assigned a dynamic href="xxx" link to?

    If the former, make sure you aren't using server.transfer as this'll render your querystring shenanigans non-functional.

    If the latter then you should really be handling the quantity change within the click event (ideally asynchronously) rather than reading the querystring on postback page load.

    Edited, also check that the click isn't triggering a validator elsewhere on the page, i've had that happen before where an onclick event wont fire because the validation is failing on a form elsewhere. In that case set the 'CausesValidation' to false on the button.
    Last edited by Durbs; 1 March 2010, 18:40.

    Leave a comment:


  • lightng
    replied
    This may be a stupid question but you're not using server code behind to try to update the URL are you? If so, it won't work - your URL will always be a page behind.

    If you post the code, I'm sure someone will be able to help. I'll have a look myself later when I'm back on - that's if someone hasn't got back to you first, of course.

    Leave a comment:


  • VectraMan
    replied
    It's the server that's different. Same client machine and browser (and IE and Firefox do the same).

    Leave a comment:


  • Jaws
    replied
    Is this using the same browser or perhaps the one on the machine? I only mention that because win2k3 has some settings to disable javascript on sites which aren't trusted.

    Leave a comment:


  • VectraMan
    started a topic ASP .NET and IIS 6 problem

    ASP .NET and IIS 6 problem

    I have a shopping basket system that's based on one written many a year ago in Perl. The initial link is something like:

    Basket.aspx?addtobasket=500

    where 500 refers to the product. The basket has up and down buttons, which call, for example

    Basket.aspx?incqty=500

    On VS2005 and whatever its test webserver is, this all works, and when I click on an up button it reloads the page increasing the quantity, and I notice that the URL in the browser address bar changes to the above.

    However uploaded to where it needs to go (a Windows 2003 IIS6 server), the up and down buttons don't work. If I click the down arrow, it reloads the page but the original "addtobasket" URL remains in the browser address bar and it carries out the addtobasket function rather than the increase/decrease.

    Can anyone shed any light on this? Maybe it's not the best approach, and I'm still feeling my way, but why does it not work consistently?

Working...
X