asp.net

RegisterClientScriptResource + AJAX update panel

Hello, I have a problem that is really making me feel dumb. I have a custom control that inherits textbox. This textbox (at least for this example) simply has a .js file that is embedded in the .dll. Long story short, works great when not in an AJAX update panel. So i did some research and found that instead of using: Page.ClientSc...

Linq dynamic select casting issue

I want to run a query to get a string array of distinct "logName" items for a logType. The following works great: Dim stringArray() As String = (From item In dc.Vw_Logs Where item.LogType = [Passed in logType] Select item.LogName Distinct).ToArray() However, this only works when a specific LogType is set. I would like the ...

ASP.Net ViewState Compression: Should I bother?

So basicaly I am working on a site that is attempting to be optimized for phones (This includes pretty much any browser enabled phone) Due to the nature of the site, I want it to load as quickly as possible. At this point, I think the page is around 30k or so in size. Now I am using viewstate, mostly for things like datagrids and not ...

How to catch all Exceptions from a WebService?

Hi, I have a Web Reference to a remote Web Service, which is called in several different classes. I'd like to catch all exceptions coming from this Web Service only. How can I do that (for example extending it's base, auto generated class) without interfering and modifying all upper level code? ...

Entity Framework: What negatives can I bump into by not disposing of my object context?

EDIT: Duplicate of Should Entity Framework Context be Put into Using Statement? I've been tossing around this idea for some time wondering what bad could happen by not properly disposing my object context and allowing it to die with the GC. Normally, I would shun this, but there is a valid reason to do it. We are using partial clas...

Create a PDF Envelope

I was in need of the ability to create a PDF Envelope, and hadn't found a good solution for doing so, so I thought that this might be of some interest. ...

asp.net mvc security question

How can I disallow anonymous access to my ASP.NET mvc controllers? Specifically, I want to require authenticated access to all controllers but allow anonymous access to resource type files such as .css and .js files. Don't plan on using membership services as I am using Microsoft Geneva. thanks! ...

How do you prevent the browser from displaying a cached version of a page?

One solution would be to add a QueryString variable to the url that is a random guid, but that seems a little messy. Is there a setting somewhere that will prevent the browser from displaying a cached version of a page? ...

Moving from Page A to Page B in Asp.Net. What is the "Best" way?

Hello, I have a user on what we will call PageA.aspx. This user needs to get to PageB.aspx. The obvious way is have a hyperlink that simply sends them to PageB.aspx. That got me thinking about the other ways to get between pages. One could use javascript to do a client side jump. There is also the seemingly bulky server side redire...

DbLinq Problems (Keyword New or MemberInit throws exception)

I'm migrating a huge web application from SQL Server to MySql. The application uses Linq so i'm using DBLinq. Currently most things are working properly except for that on a few pages i get a strange error. It all started with this: Property 'Int32 ForumID' is not defined for type 'DbLinq.Data.Linq.Table`1[CPost]' I've obviously got ...

ASP.NET Dynamically added LinkButton - OnClick handler is not being called

Hi, I am adding a LinkButton control dynamically into a PlaceHolder. If I add a new instance of the LinkButton on every OnInit(), then OnClick handler for this LinkButton works. However, if I store the instance of LinkButton in the session and then add it into collection of controls of the PlaceHolder, LinkButton.OnClick fails to fire....

visual studio 2008 / asp.net web forms - is hand coding ~80% of the time too much?

I still find myself hand coding Visual Studio projects more than using the variety of UI-driven menus and dialogs. For example: web projects: hand code html/css in Source View vs dealing with the Design View / Properties Window flushing out class files: code by hand using stuff like the prop-TAB-TAB Create Property keyboard shortcut a...

Jquery asp.net Button Click Event via ajax

Hi all, I was wondering if anyone can point me in the right direction. I have an asp.net button with an click event (that runs some server side code). What i'd like to do is call this event via ajax and jquery. Is there any way to do this? If so, i would love some examples. Thanks in advance ...

Mixing ASP.NET Webforms and ASP.NET MVC

I am having trouble with forms authentication. The root web.config is setup to deny access to all non authenticated users with a structure like: Controllers Folder - Webforms Folder1 - Webforms Model Public Folder - Webforms with web.config to allow public access Views web.config with deny I need to have the home controller public as...

ASP.NET MVC vs. Webforms vs. HTTP Handlers (.ashx) - which is the most lightweight?

I plan on building a simple, yet high usage webapp and need to settle on an architecture. basic server side logic / dynamic db driven content about half a dozen to a dozen pages serving up all said content no need for URL rewriting, pretty simple page flow/routing The objective is to publish this app to use the least amount of band...

Running Visual Studio in Parallels for mac - problem with debugging sites sitting in os x drive

I've installed parallels desktop on my MacBook to be able to run Visual Studio 2008 in a XP installation. Everything works great except when I decided to put my websites in my sites folder in the os x file system (Which by default automatically happens because the My Documents folder is mapped to the Mac's Documents folder, and I'd rathe...

Problem Encrypting a Cookie Using Handmade Encryption (ASP.NET)

Hi I am facing a weird problem: I am encrypting the contents of a cookie. My code works fine when I run it in Visual Studio, but gives me a "Bad Request, HTTP Error 400. The request is badly formed." when I run it from the server. Here is the class for encryption Encrypt Cook.cs, resides in app_code: public class EncryptCook { publi...

Disable all controls (textbox, checkbox, button etc) in a View (ASP.NET MVC)

While rendering the view page, based on some condition in the controller action I want to disable all the controls (textbox, checkbox, button etc) present in the form in a MVC view page. Is there any way to do that? Please help. ...

Adding a new row (with a templated column) to an Infragistics UltraWebGrid

I am using the Infragistics UltraWebGrid to capture some data. I don't have this grid bound to a datasource, I simply access the values I need when the user clicks a save button. I need to add autocomplete functionality to one of the columns in this grid, easily achieved with an asp.net textbox and ajaxtoolkit autocomplete extender. Pr...

How can I insert a file in SQL Server using ASP.Net?

Hello! I'm developing an ASP.NET app (C#) that connect to SQL Server 2008 using ADO.NET entity framework. The user of this app can select an image from his local hard drive to insert in SQL Server. How can I do this? I know how to store the image into SQL Server but I don't know how to upload the image to the server (using FileUpload ...