asp.net

Is there a good reason why AntiXss.JavaScriptEncode wraps result in single quotes?

I've been using Microsoft's AntiXss Library and was wondering if there is a good reason why its JavaScriptEncode method wraps the result in single quotes? That behavior seems unconventional. ...

"Bad Storage property" error on LINQ to Stored Procedure

I just added a newly created SP to my project which unfortunately required a temp table to operate, so I had to build my RESULT class for the SP manually. Now when I try to run I get a "Bad Storage Property" error on the below property. public partial class sp_One_EVA_Get_User_InformationResult { private string _Security_USER_ID; ...

asp.net Ajax timer control

i have a page with a timer control. when the page is loaded, it fires a function. my issue is that the title of the page appears initially, but after the timer control function finished, the string in the title disappears. I commented everything out of the timer function and the title in the string still appears. what am i doing wrong? ...

Unit testing asp.net mvc - Can viewengine find the view?

Hi I am finding that a common breakage point in our mvc setup is when the controller returns return View(); or whatever, and the viewengine cannot find the view. I would like to be able to test my controllers and then run ExecuteResult on the resulting ViewResult but the underlying ViewEngine is so tied to virtual directories that...

Why isn't the GridView width expanding 100% across the page when I set the width?

I have the following markup, I took the extra stuff out of the divs, so it is easier to understand. I had my GridView set to 100% with collaspible panel extenders and it was showing fine on the page. Then instead of doing collapsible panel extenders and using accordion panels, the gridview only expands as much as it needs, no matter w...

Getting ASP.NET Cookieless Sessions and JQuery AJAX to play together nicely

I have a web site that uses JQuery AJAX. With this JQuery code $.post("/ajax/getsomedata.aspx", {'id': id }, function(data) { dosomething(data); } ); When I run this with cookieless="false", id shows up in Request.Form. When I set cookieless="true", id is no longer in Request.Form. UPDATE, What I did I added...

Invalid object name error when trying to execute stored procedure?

Not sure what the deal is I have the stored procedure named exactly what I am calling however it always gives me this invalid object error. Here is the connection code, the error is thrown on the second to last line there. SqlConnection cnstr = new SqlConnection(ConfigurationManager.ConnectionStrings["darconn"].ConnectionString); ...

Is EnableHeaderChecking=true enough to prevent Http Header Injection attacks?

Is it sufficient to have System.Web.Configuration.HttpRuntimeSection.EnableHeaderChecking set to true (default) to fully prevent Http Header Injection attacks like Response Splitting etc.? I'm asking because a white box penetration testing tool (fortify) reports exploitable http header injection issues with HttpResponse.Redirect and coo...

Ajax replacment for JavaScript prompt command

The JavaScript prompt command prompt("sometext","defaultvalue"); is a useful way to easily prompt the user to provide a value. But it can't really be a part of any polished web 2.0 application (The dialog looks horrible). Is there any existing component to display a modal dialog that will prompt a user for a value? I can use a pure J...

How to authenticate on ASP.NET

Hello! I'm developing an ASP.NET app (c#) that need to authenticate users. To do that I have a SQL Server database with the users of this application. Which is the best way to do that? I've been reading this: http://msdn.microsoft.com/en-us/library/xdt4thhy.aspx In the example I will to replace this code: <script runat="server"> ...

Accessing SessionState in IHttpModule after 404 ??

Hi, Is it possible to access SessionState in the Error event handler of a HttpModule following a 404? Im trying to implement a consistent error handling mechanism for both full and partial postbacks using the technique described in this blog post, ASP.NET Error Handling...... Instead of passing loads of parameters on the query string...

Problem using UpdatePanel with Masterpage in C#...

Hi guys... My code : <%@ Page Language="C#" %> <script runat="server"> void button_Click(object sender, EventArgs e) { label.Text = "Refreshed by server side event handler at " + DateTime.Now + ".<br>Value provided:" + text.Text; } </script> <html> <head> <title>How to update an UpdatePanel with JavaScri...

How do I add an additional CSS class on a surrounding DIV for failed form validation?

Here's my scenario: <!-- Normal Control --> <div class="required"> <label for="address1">Address line 1</label> <input type="text id="address1" name="address1" class="inputText" /> </div> <!-- Same Control - but with a validation error --> <div class="required error"> <p class="error">Address Line 1 Field is requi...

Crystal Report in ASP.NET - display image

I am using a Crystal Report on my website to dynamically build a PDF file for download. This is working great. However, now I want to add an image to the report. When I go to Insert - Picture, browse to my image file, and click OK nothing happens, which leads me to believe that I'm adding it incorrectly. How can I do this? Also, doe...

Which event fires after using the Cancel command on a DetailsView?

I need to perform a few checks (enable or disable a label elsewhere on the page) after the user Inserts or Cancels the DetailsView. I have to do this because the DropDownList.SelectedIndexChanged doesn't fire during this event (which is dumb in my opinion, since the index DOES change). ...

Multiple Login Modes in ASP.NET - Advice Needed

Looking for a bit of advice on where to take a current webapp which supports logins based on active directory and makes use of the built in asp login component. The problem is that we want to have the option to use the active directory login or a "normal" login using data stored in our local database. Just to make it clear. On each in...

ASP.NET Validation

Im getting a validation error when a user enters a Foreign name. An example is: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00$pageContent$txtName="Pedro ú logo"). where the ú is being translated as & # 250 ; (without the spaces of course) These foreign charac...

How to dump the whole POST data to a file in ASP.NET

hi ! I'm currently trying to port an app from asp.net to php, however I just hit a wall and need a hand with this. I need to dump all the data an .aspx recieves via POST to a file, but I have no clue on how to do this any ideas ? thanks in advance! ...

UpdatePanel not refreshing display

I have an UpdatePanel inside of a custom control, and within that UpdatePanel are two placeholders. One is initially set Visible = false, the other true. Inside the visible one I have an ImageButton that toggles the visibility of the placeholders. I'm using this control on two different pages in my site. On the home page it works as ...

Programatically Generating WebControls

I have a page that, depending on input from a previous page, lists a varying number of different questions pulled from a database. I can't seem to find an example of this online: For each question that is displayed, I need to programatically generate a DropDownList so that the user can select yes or no for each of these questions. Hoping...