asp.net

load a user control programmatically in to a html text writer

I am trying to render a user control into a string. The application is set up to enable user to use tokens and user controls are rendered where the tokens are found. StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HtmlTextWriter writer = new HtmlTextWriter(sw); Control uc = LoadControl("~/includes/Homep...

Foundations of Network Security (IIS, SQL, RDP, etc) for a Developer

Not sure if anyone listened to Hanselminutes episodes 134 and 135, but at the end of show 135 Scott Hanselman had a lot of great advice on how to setup a baseline secure environment for a web application. As a developer, most of my time is focused on developing the application, not on the network facet of the project, however as a start...

Why do I get "Unable to start debugging on web server" when running asp.net?

I am trying to debug a web application through IIS that has a virtual directory other than localhost. It compiles fine but gets the above message anytime that I try to start debugging. I have compilation debug="true". ...

Does anyone know a way to "share" a datasource without causing multiple postbacks?

For instance, I have a SqlDataSource that loads a list of items. On my form, I've got 3 dropdown boxes that both should contain that same list of values, and then the user can select a different value for each and save. By hooking up each dropdown list to the same SqlDataSource, the database gets hit three times - one for each object t...

Passing form data from masterpage to other pages ASP.NET

I have asked a similar question before, but I didn't have a firm grasp on what the problem I was encountering was. My problem is I cannot get the data from a TextBox residing on the master when the page changes. Here is what happens: MasterPage with TextBox and Button. Data is entered into the TextBox and Button is clicked. Form's ac...

Tools and methods for live-monitoring ASP.NET web applications?

I think many developers know that uncomfortable feeling when users tell them that "The application is slow (again)." In a complex web application there can be many possible reasons for a degradation in (perceived) performance: slow database response, bandwidth issues, bad caching etc. There certainly are issues which will never occur in...

What is the difference between <%# Bind("") %> and <%# Eval("") %> in ASP.NET?

I have seen bind and eval used interchangeably especially in ASP.NET GridViews. What is the difference? ...

How do I determine if an asp.net url has been "rewritten"?

I'm using http://urlrewriter.net/ to rewrite urls at my website. For example, I'm rewriting: http://www.example.com/schedule.aspx?state=ca to http://www.example.com/california.aspx What I'm trying to do (for SEO purposes) to to dynamically add the meta tag: <meta name="robots" content="noindex,follow" /> only to the page t...

Wrapping a web login page

I have a web login page with the standard username password and login button controls. I would like to write a wrapper page that will render and auto fill the username and login form text boxes with a constant and force the onclick event for login button. Any suggestions how to accomplish this? ...

Calling internal methods in Medium Trust

I have the requirement to call an internal method of a 3rd party object (I cannot make it public for example). I can do that via reflection. Unfortunately this does not work in ASP.NET Medium trust due to insufficient rights: <IPermission class="ReflectionPermission" version="1" Flags="RestrictedMemberAccess"/></PermissionSet> Is ther...

Is it possible to share ONE file with strings between ASPX, C# and JavaScript?

I'd like to externalize all of the strings used in the project into one file and be able to use it inside aspx, C# code behind and on the client side in JavaScript. The reason I want to do it is because many strings are shared, i.e. the same in two places. Is it possible? Is there a better way? ...

Redirects to default.aspx instead of "xxx.aspx" after logging into app using login control

Hi Thanks for going to answer my question. I have the folowing pages. login.aspx default.aspx xxx.aspx After logging into application default.aspx will be displayed. Now if the user is trying to open http://server/xxx.aspx?Id=1234 by specifying its URL directly in a browser, the login screen is displayed and after successfull login,...

<base target="FrameName"> doesn't work on IE7

It seems that the following piece of HTML is ignored in IE7 but works ok in IE6/FF. It supposes to override all the html links to be opened in the desired frame <HEAD> <title>LeftPane</title> <base target="rightFrame"> </HEAD> The above code is the header of a left frame that holds an Infragistics UltraWebTree (tree menu) wh...

Page View Counter - Database Setup and Technique/Strategy

I am developing a page view counter to track the amount of views a page is having on our site and displaying it to the user. (I asked an intro question before: http://stackoverflow.com/questions/246919/page-view-counter-like-on-stackoverflow). Using the recommendations, I developed a httpHandler which will handle the request whenever th...

Client side image caching with ASP.Net

This is really two questions, first, do browsers normally cache images on the client by default or does the server have to indicate that they can be cached? Second, given that I do not have access to IIS what can I do in an ASP application to improve client side caching of images. ...

How to bind a label inside a gridview to another table?

I have a very standard Gridview, with Edit and Delete buttons auto-generated. It is bound to a tableadapter which is linked to my "RelationshipTypes" table. dbo.RelationshipTypes: ID, Name, OriginConfigTypeID, DestinationConfigTypeID I wish to use a label that will pull the name from the ConfigTypes table, using the "OriginConfigTypeID...

What is the best method to keep bots from spamming your blog?

Hey all! I got a problem at my blog. I got visits from kind bots who leave "nice" comments to my blog posts :( I'm wondering if there is a smarter way to keep them out, besides using the captcha modules. My problem with the captcha modules is that I thinks they are anoying to the user :( I don't know if it's any help to anyone but m...

Replacement for NUnitAsp

Hi, Are there any replacements for NUnitAsp that anyone knows of for testing ASP.NET pages? ...

Which .net programming language should I learn as a web developer?

I'm a web developer who is still 'stuck' in the classic asp world. I want to step up to .net but I am unsure of which language to learn - most likely out of VB or C#. Are there any compelling arguments to choose one over the other? ...

How do you update an ASP.NET web application?

Simple question. If you have a compiled and published ASP.NET web application running on a server and you need to update, say, a line in one of the codebehind files. Do you shut down the entire site, republish, then load the site back up? Or do you publish straight to your live site with users still using it? ...