asp.net-4.0

Default.aspx with IIS 6.0 and .Net 4?

We have deployed a .net 4 asp.net site on IIS 6.0. Default.aspx is configured as one of the default document. When we access the site using the following url http://testsite We expect it to render http://testsite/Default.aspx But instead we get 404 Not found error. We did not had this issue when it was deployed on .Net 2.0. On...

ASP.NET WebForms vs MVC [after VS2010/.NET 4.0 announcement]

Two of the biggest advantages of MVC over webforms were non-existent viewstate and URL routing. VS2010 and .NET 4.0 incorporates built-in URL routing for Webforms as well as better control for viewstate. I advocate use of MVC for extranet sites due to the MVC design pattern and its general lightweight nature but in light of this new an...

asp.net 4.0 webforms - how to keep ContentPlaceHolder1_ out of client id's in a simple way?

I'm attempting to introduce master pages to an existing webforms site that's avoided using them because of client id mangling in the past (and me not wanting to deal with the mangling and doing <% foo.ClientID %> everywhere :) GOAL: use 'static' id values (whatever is in the server control's id attribute) except for data-bound / repeati...

ASP.Net - Align MS Chart Control Horizontally

Hi, I'm using the Microsoft chart controls for ASP.NET(4.0) and I'm attempting to create 3 pie charts and have them align horizontally but finding this impossible. Would anyone know how this is done? Currently I have 3 different series and 3 different chart areas, all in the same chart control. I tried putting them on a single Chart Are...

IntegrationTests - A potentially dangerous Request.Path value was detected from the client

I get this error: A potentially dangerous Request.Path value was detected from the client (?). when this URI: http://www.site.com/%3f. How can I write an integration tests around of all of this type of errors? I want to test against all this erros: A potentially dangerous Request.Path value was detected from the client A potentially ...

ASP.NET 4 URL limitations: why URL cannot contain any %3f characters

http://site.com/page%3fcharacter This URL will return the following error: Illegal characters in path. I'm already put this in web.config: <system.web> <httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" /> <pages validateRequest="false"> ... How can I fix this error? ...

ASP.NET 4.0 Routing and Subfolders

I have a folder structure like this: www.mysite.com/About/About.aspx I have a link in a user control like this: <a href="~/About/About" id="aboutLink" title="About" runat="server">About</a> And in my RegisterRoutes() method, I have this: routes.MapPageRoute("", "About/About/", "~/About/About.aspx"); It works but produces the fol...

Problem with RenderOuterTable property for .NET 4.0 controls

According to the new 4.0 framework overview, one should be able to add the attribute RenderOuterTable="false" to a control that supports the attribute and see CSS friendly code be spit out - in other words no HTML tables. To test this, I threw a login control into a basic fresh webpage with the following code: <asp:Login ID="Login1" ...

books about ASP.NET 4 for those familiar and experienced with previous versions

I'm looking for a book that addresses the changes in ASP.NET 4 without too much rehashing of ASP.NET 3.5 or 2.0. Any recommendations on Amazon? ...

Do you use <%: %> or <%= %> for html helpers in ASP.NET MVC 2.0?

I know they now have this in ASP.NET MVC 2.0 <%: Model.CustomerName %> So when you make HTML helpers is it better to use this way now (provided that you do not want to do HTML encoding)? ...

System.Web.Routing in .net 3.5 (Not MVC)

Hi, I've used routing with asp.net 4.0 but one of my hosting companies haven't updated .net framework yet and I want to use routing with asp.net 3.5. Is it possible to use System.Web.Routing in asp.net 3.5? ...

IIS 7, Asp.Net 4: Server cannot append header after HTTP headers have been sent?

I am getting the following warnings on the Event Log for a Asp.Net WebSite running on IIS 7. Exception information: Exception type: HttpException Exception message: Server cannot append header after HTTP headers have been sent. at System.Web.Hosting.ISAPIWorkerRequest.SendUnknownResponseHeader(String name, String value) ...

Visual Studio's Format Document – How to Write it in C#

I'm having a go at writing some C# code which overrides the Render method of the System.Web.UI.Page and then reformats the HTML before presenting it to the browser. This is purely experimental so overhead is not a concern right now. I'm perhaps a little learned in the ways of the regular expression and would like to utilise them here, b...

Control Attributes render Encoded on dot net 4 - how to disable the encoding ?

I have an issue in asp.net 4. When I add an attribute on controls, then the render it encoded. For example, when I type this code txtQuestion.Attributes["onfocus"] = "if(this.value == this.title) { this.value = ''; this.style.backgroundColor='#FEFDE0'; this.style.color='#000000'; }"; I get render onfocus="if(this.val...

ASP.NET 4 UpdatePanel and IIS7 Problem

I have an ASP.NET 4 webpage that contains an update panel which just allows me to add a few items to a drop down list without reloading the entire page. The page works fine on the Visual Studio 2010 ASP.NET Development Server, performs the Async call and the page is properly laid out. However, when I deploy the page to IIS7, the Async ...

TempData["message"] isn't reliable-- what am I doing wrong?

I'm using TempDate["Message"] to show little update banners as the user does things on my site like this: [AcceptVerbs(HttpVerbs.Post), Authorize(Roles = "Admins")] public ActionResult Delete(int id) { _Repo.DeletePage(id); // soft-delete TempData["Message"] = "Page deleted!"; return RedirectToAction("Revisions", "Page", ne...

ASP.NET Web Site Administration Tool unkown Error ASP.NET 4 VS 2010

I was following the MVCMusic tutorial with an machine with full sql server 2008 r2 and full visual studio professional, in ASP.NET 4.0 and when I got to the page where it sets up membership (near page 66) the Web administration tool wont work, i got the following error: An error was encountered. Please return to the previous page and tr...

Is it necessary to create ASP.NET 4.0 SQL session state database, distinct from existing ASP.NET 2.0 ASPState DB?

Is the ASP.NET 4.0 SQL session state mechanism backward-compatible with the ASP.NET 2.0 schema for session state, or should/must we create a separate and distinct session state database for our ASP.NET 4.0 apps? I'm leaning towards the latter anyway, but the 2.0 database seems to just work, though I'm wondering if there are any substant...

web.config custom error path

<httpErrors defaultPath="/Views/Error/Error.htm" errorMode="DetailedLocalOnly"> <clear /> <error statusCode="404" path="/Views/Error/404.htm" /> <error statusCode="500" path="/Views/Error/500.htm" /> </httpErrors> Is the paths over here are valid? how can I use valid relative path? ...

How to create RouteUrls with databound parameters declaratively?

I'm using the new Routing feature in ASP.NET 4 (Web forms, not MVC). Now I have an asp:ListView which is bound to a datasource. One of the properties is a ClientID which I want to use to link from the ListView items to another page. In global.asax I have defined a route: System.Web.Routing.RouteTable.Routes.MapPageRoute("ClientRoute", ...