asp.net

What do I need to change to alllow my IIS7 ASP.Net 3.5 application to create an event source and log events to Windows EventLog?

ASP.Net 3.5 running under IIS 7 doesn't seem to allow this out of the box. if (!EventLog.SourceExists("MyAppLog")) EventLog.CreateEventSource("MyAppLog", "Application"); EventLog myLog = new EventLog(); myLog.Source = "MyAppLog"; myLog.WriteEntry("Message"); ...

Useful new .net(3.0,4.0) technology features.

Previously it was .net 2.0 which is the big change in .net developement. many developers are working mostly on this. Presently microsoft has introduced .net 3.0 and yet its next version .net 4.0. So the next version is going to be major change in .net development. I have listed some features of this... Workflow foundation WPF WCF Windo...

What could cause "Connection Interrupted" on LocalHost when debugging in ASP.NET

I'm trying to run a freshly created ASP.NET Website using C#, however when I do so it launches FireFox and attempts to connect to http://localhost:1295/WebSite1/Default.aspx (for example), but after about 10-15 seconds it displays a "Connection Interrupted - The connection to the server was reset while the page was loading." Error. This...

Nod32 causing LocalHost (ASP.NET Development Server) "Connection Interrupted" Problem

I'm quoting myself on a previous question I asked to further explain: "I'm trying to run a freshly created ASP.NET Website using C#, however when I do so it launches FireFox and attempts to connect to http://localhost:1295/WebSite1/Default.aspx (for example), but after about 10-15 seconds it displays a "Connection Interrupted - The conn...

Share HttpContext code between web and non-web application

I've got a VB.NET module that reads from a resource file to display text in the correct language. Here's my problem - this code is shared between a web application and a non-web application, In the web application, I'm using System.Web.HttpContext to determine the user's preferred language, but now my Windows app won't even compile, beca...

How can I invoke (web) Button.Click in c#?

As the title really, I'm in one part of my code and I would like to invoke any methods that have been added to the Button.Click handler. How can I do this? ...

Setting focus to a button from from text box?

Hi, i have a few text boxes and buttons on my form. Lets say txtBox1 is next to btnSubmit1, txtBox2 is next to btnSubmit2, txtBox3 is next to btnSubmit3. How can i set the focus on btnSubmit3 when the user starts to type something in txtBox3. Meaning..... if a user type in a text box the program will know what button to fire when the u...

What UI pattern do you use for asp.net (mvp, passive view, etc.)?

I want to start building more testable web apps, unfortunately I am not able to go with Microsofts MVC framework just yet. So I am looking advice. What UI pattern do you guys use with asp.net apps, and how do you implement them? I do understand patterns like MVP, MVC, etc., but I don't have any experience implementing them, so any input...

abcPDF 7 converting HTML to PDF but only getting the first page converted

I'm currently using abcPDF 7 to convert HTML to PDF. This is done via an ASPX page where I override the Render method. Doc theDoc = new Doc(); theDoc.SetInfo(0, "License", m_License ); theDoc.HtmlOptions.Paged = true; theDoc.HtmlOptions.Timeout = 1000000; string callUrl = "http:// my app page"; theDoc.AddImageUrl(callUrl); Response.Cle...

How to add CardSpace support to your ASP.NET application

Hi, I like the idea of CardSpace but unlike OpenID it seems like a real PITA to support it in your ASP.NET web application. I've found many examples, even a tutorial in one of the books I own... but it would seem a lot more is required than what they suggest. Changes to the server and such? Can someone tell me: What I need to confi...

DNS of the server where ASP.NET application is run

How to get to know DNS name of the server where ASP.NET application is run? I want to get string "www.somehost.com" if my application URL is http://www.somehost.com/somepath/application.aspx Is there some property of Server, Contex, Session or Request objects for this? Thanks! ...

How do you convert Html to plain text?

I have snippets of Html stored in a table - not entire pages, no tags or the like, just basic formatting. I would like to be able to display that Html as text only - no formatting - on a given page (actually just the first 30 - 50 characters but that's the easy bit). How do I place the "text" within that Html into a string as straight...

ASP.NET How to best create a test DB when doing TDD?

Hi folks, what's the best practice for creating test persistence layers when doing an ASP.NET site (eg. ASP.NET MVC site)? Many examples I've seen use Moq (or another mocking framework) in the unit test project, but I want to, like .. moq out my persistence layer so that my website shows data and stuff, but it's not coming from a datab...

How to test User Control with unit that relies on the Session object

I'm using ASP.NET to build an application and the latest version of NUNIT framework to test it. I'm constructing a User Control to build a custom menu. That control at some point checks whehter a specific object exists in the Session Collection or not to add some elements to the menu. The exact functionality it provides is this: if the ...

How can I get the user response regarding SaveFileDialog in Javascript?

Hi all, The following code is implemented in Page_Load event to show SaveFileDialog to the user string targetFileName = Request.PhysicalApplicationPath + "Reports\\TempReports\\FolderMasters" + Utility.GetRandomNumber() + ".pdf"; FileInfo file = new FileInfo(targetFileName); // Clear the content of the response. Response.ClearContent(...

What interface should I implement to create step driven events for my class?

I want to create a similar behavior to the data reader class but for a bespoke emailer program so that I can do the follow Dim sender As New EmailSender(emailTemplate) While sender.Send() Response.Write(sender("HTMLContent")) End While Is there an advised interface or mustInherit class to utilize the stepping functionality so that s...

Launch ASP Development Server Manually?

There has to be a way to do this, I was googling information but I can't seem to get it to work. The sites I checked out said to do something along the lines of start /B %WINDIR%\Microsoft.NET\Framework\v2.0.50727\webdev.webserver.exe /path:"D:\MyFolder" /vpath:/HelloWorldWebSite In a batch file. However, none of my framework folder...

Closing the browser should actually clear the session variables an ASP.net session id.

I have an ASP.net page. When I am closing the webpage I need to clear the session variables. How to to handle this I need to maintain the timeout to 20 minutes. If he closes and login for any number of times in the 20 minutes timed out time Is there any possiblity for clearing the ASP.net session id ...

How do I declaratively insert a property value of a page into it's rendering?

I would like to have an aspx page that contains something like.... <form id="form1" runas=server > Hello <%= Me.UserName() %> </form> and a code-behind something like... Public Class Somepage inherits SomeOtherPage Private Readonly Property UserName() as String Get return "Rory" End Get End Property E...

Canceling request validation using HttpHandler on IIS 7

I have an application that has to deal with getting "special" characters in its URL (like &, +, %, etc). When I'm sending a request to the application using these characters (of course I'm sending them escaped) I'm getting "Bad Request" response code with the message "ASP.NET detected invalid characters in the URL". Tracing the request s...