asp.net-4.0

Routing to an anchor on another page

I am using Web Forms Routing in ASP.NET 4 and I am trying to route to a specific location on a page. On that page I have an element like <div id="3"> and I'd like to jump to this anchor from another page. For this purpose I have defined a Route in global.asax: RouteTable.Routes.MapPageRoute("MyRoute", "Path/SubPath/{PageAnchor}", "~...

Asp.net 4.0 child application does not work on IIS 7.5?

I have a Website on IIS 7.5 configured as shown below. ParentWebSite ---ChildWebApp ParentWebSite is an Asp.Net 4.0 Website project. ChildWebApp is an Asp.Net 4.0 Web Application. When I access the following url it works fine. http://ParentWebSite/ When I access the childWebApplication using the following Url. http://Par...

Why do I get to the endOfStream in a webrequest, if it is a persistent (keepalive) connection?

I have a webrequest that createst a persistent (keepalive) connection to the server, e.g.: webRequest.ContentType = "application/x-www-form-urlencoded"; // Set the ContentLength property of the WebRequest. webRequest.ContentLength = byteArray.Length; webRequest.Timeout = Timeou...

In ASP.NET MVC, what is the difference between <%= and <%:?

I'm new to ASP.NET MVC. I've seen both <%= ... %> and <%: ... %>. I'm familiar with the first from classic ASP days, but not the latter. What is the difference between the two? ...

Asp.Net sharing session across multiple web applications?

I have to share session data between two different Asp.Net Application. The deployment of web apps are as shown below. WebSite --WebApp1 --WebApp2 I have to use same Session data between WebApp1 and WebApp2. Also WebApp1 and WebApp2 both share the same Domain(www.WebSite.com) and AppPool What is the easiest way to make these...

Impersonate a User from Code Behind via Forms Authentication

Is it possible to Impersonate a user when using Forms Authentication? The thing is that I want an external login for users and an internal site that just uses integrated windows security and the users need to be impersonated. I've looked around and found that John's answer here is really good, but I don't quite get how I can mix it up ...

ASP.NET get all virtual subdirectories of site?

Hi there, is there a way to get all available virtual directories that are listed below the directory of the current site? Like string[] virt = Directory.GetVirtualDirectories("."); or something like that? Thanks Hendrik ...

Custom Data Annotations IsValid is never invoked. (ASP.NET MVC 2 .NET 4)

I have a custom Data Validation Attribute I've created to make sure the passwords a user inputs are the same, but IsValid is never invoked. Custom attribute: public class IsSameAsAttribute : ValidationAttribute { public String TargetProperty { get; set; } private readonly object _typeId = new object(); public IsSameAsAtt...

What is the easiest way to give nice URLs to my ASP.NET WebForms application?

I have a big, fat, legacy ASP.NET WebForms application with big, fat, legacy URLs: /ViewDocument.aspx?documentId=72143&noRedirect=1&someOtherCrapThatJustSeemsToGoOnForever=AndEver What is the simplest way to implement pretty URLs in WebForms using ASP.NET 3.5? Is there anything in ASP.NET 4 that will make this easier? Should I impleme...

Default Page for a Site in ASP.NET 4.0 Not IIS

Hello everyone Is a quick question, I've been searching around with no luck, I'm a newbie in ASP.NET webforms. Is there any way to set the default page for a site, meaning, when I Send a Get for http://{domain|localhost}/ it gets me the Default.aspx or any I set? I know I can set that redirect in IIS (i'm using 7.5), but I want to know...

ASP.NET Dynamic Data 4.0 - Search Results?

I have a ASP.NET (VB) Dynamic Data Project in ASP.NET 4.0. It works great - and offers filtering - but now I want to add searching to it. What is the best way to accomplish this in ASP.NET 4.0? Is there any built-in functionality for performing searches declaratively? ...

Is MEF For Me? (one core application allowing client applications to plug into it)

I'm trying to determine if MEF is a the proper direction our application framework should be taking. From my reading of MEF, our framework doesn't seem to 'exactly' fit in, but I'll see if any experts can guide me. Our framework allows us to have one core website and dependent assemblies deployed to one place (and fixes or features are...

Adding a clientside onload function to an ASP.NET control in 4.0 encodes my quotes

I'm trying to add a Javascript function to the onLoad event of a asp:Panel. It goes something like this: string clickFunction = "$('[id*=lblHiddenPageArray]').text('');" PagesPanel.Attribues.Add("onLoad", clickFunction); I'm attaching this function to other controls (Checkboxes and Buttons) and it's working fine. But in the PagesPa...

Application Root Operator (~) problem with Virtual Directory in IIS 6.0

I have a web application that runs fine locally, but when I move it to a virtual directory on the web server (let's call it "VirDir"), it adds the directory name to the relative path. For example, if I try to access ~/Default.aspx, it will tell me that it cannot find /VirDir/VirDir/Default.aspx. Is it something boneheaded, or do I just...

Problem with <system.web.extensions> config group when upgrading to .NET 4.0

Hi Guys, So we've upgraded our site from 3.5 SP1 -> .NET 4. When we ran the site, we got an Internal Server Error (500), stating the following configuration group could not be read: <system.web.extensions> <scripting> <scriptResourceHandler enableCompression="true" enableCaching="true" /> <webServices>...

ASP.NET 4 Web forms Routing images

I'm using ASP.NET 4 Web forms routing, for example like this: routes.MapPageRoute("page-browse", "{Language}/{Label}", "~/Default.aspx") So the webadress could look like: http://localhost/mywebsite/eng/home In the root of my website I have a folder "Images". Image display works when I'm in the root of my website, e.g. by using http://l...

UserControl doesn't appear on page if dynamically added in Page.Load

I have a custom ASP.NET user control that is added to a panel on a web page in the Page.Load method. The control contains some Labels and a GridView. I'm adding it to the page with this code: ReportingControl rc = new ReportingControl(this.Username, this.SoaContext, transactionId, p.PaymentTypeRequestKey); this.pnlPB.Controls.Add(rc);...

.Net 4.0 application running in IIS 7.0 - Hanging under load

Hey, My company is running a .NET 4.0 site in IIS 7 on a windows 2008 server machine. Our site hits are steadily increasing and now we're getting issues during peak usage periods. The site will hang for a time making requests that should be nearly instantaneous take long periods of time (up to 30 seconds). We run a load balanced envi...

How to get rid of ugly asp:Menu flickering?

I'm using the asp:Menu control on an ASP.NET 4.0 Webforms page with table-free rendering mode: <asp:Menu ID="MenuBase" runat="server" DataSourceID="SiteMapDataSourceMenu" Orientation="Horizontal" CssClass="contentmenu" RenderingMode="List" IncludeStyleBlock="false"> </asp:Menu> The menu has a horizontal main row with 5 or 6 m...

ASP.NET MVC 2 Input ID

Adding the following to my view: <input type="text" runat="server" id="newBookingRef" name="newBookingRef" /> Results in the following HTML: <input type="text" id="MainContent_newBookingRef" name="ctl00$MainContent$newBookingRef"> If I use the helper method Html.Textbox, the ID is generated as I would expect "newBookingRef". How c...