asp.net

I need to validate free flow textbox value matches value from database table

I need to validate a given Name field in the asp.net form. User Name: Alex Brandon In the database, we have a users table with user_name column. I need to validate on lost focus of User Name form field, that it exists in the users table and is valid else show an alert. Does somebody has a ready solution to this? ...

When I Branch from Trunk I need to create a new Virtual Directory. Anyway around this?

the Trunk of my app points to <IISUrl>http:///localhost/MyApp/&lt;/IISUrl&gt; Whenever I create a new branch, I end up having to edit MyApp.csproj to change the target URL to <IISUrl>http:///localhost/MyAppBranchName/&lt;/IISUrl&gt; Is there any way that I don't need to do this? The reason is the number of branches are starting t...

ASP.NET postbacks lose the hash in the URL

On an ASP.NET page with a tabstrip, I'm using the hash code in the URL to keep track of what tab I'm on (using the BBQ jQuery plugin). For example: http://mysite.com/foo/home#tab=budget Unfortunately, I've just realized that there are a couple of places on the page where I'm using an old-fashioned ASP.NET postback to do stuff, and whe...

A potentially dangerous Request.QueryString value was detected from the client when sending html markup from jquery post call to asp.net page

I m making an ajax call using jQuery to an asp.net page which acts as my ajax server page to save the data which i am sending to it in the querystring. in the asp.net page when i am trying to read the querystring i am getting this error A potentially dangerous Request.QueryString value was detected from the client... I have set the V...

AJax JSON Call error when trying to access the properties of class

I am making a JSON call to web method which is defined in code behind. The web method returns a class object.The class returns 3 properties one of type list and 2 integers. I am accessing these in the following manner: success: function(result) { alert(result); alert(result.LookCount); ...

How to configure a proxy class for an ASP.NET web service for flexible deployment to production

I inherited a web app at the Visual Studio 2003 level that placed all of its code for accessing SQL server in an ASMX web service. This web project had a web reference to the web service. I needed to bring the whole thing under source control, upgrade it to Vstudio 2008 and make a bunch of fixes and enhancements. In doing this, I came ...

Sending Client Certificate though HttpWebRequest, intermittenly working.

I have created a web application that calls a web service that requires a Client Certificate for authentication. Here is a snippet of how I am building the request: // Grab Certificate X509Certificate2 cert2 = new X509Certificate2(AppDomain.CurrentDomain.BaseDirectory + GiftCardConfig.A2A_CertificateLocation, Gif...

Get DisplayName Attribute without using LabelFor Helper in asp.net MVC

What is the best way to retrieve the display name attribute for an item in your model? I see a lot of people using the LabelFor helper for everything, but a label isn't appropriate if I just want to list the data out. Is there an easy way just get the Name Attribute if I just want to print it out in, say a paragraph? ...

onClick event in VB.NET

I am programming in VB.NET. I am trying to make an onClick event for a div tag. How can I make this in the code behind? ...

When should Page.Header.DataBind be called?

I'm trying to resolve correct paths to javascript scripts in my head section using: <script src="<%# ResolveUrl("~/Scripts/jquery-1.4.2.min.js") %>" type="text/javascript" /> In order to resolve the path I need to call databind using Page.Header.DataBind(); What event should I place the databind call in? Thanks. Reference: http://l...

How to build customized ListView that can fire the SelectedIndexChanged event ?

Hi guys, I'm trying to generate the following html: <ul class="listItems"> <li class="Selected">Val1</li> <li>Val2</li> <li>Val3</li> <li>Val4</li> <li>Val5</li> </li> I thought of using a ListView and customize its ItemTemplate. <ItemTemplate> <li> <asp:LinkButton Text='<%#Eval("BoundItemField")%>' CommandName="Select" ...

Two asp:content in web content form

Whenever I create a new Web Content Form in asp.net and select a master page. I get two asp:content controls. If I delete the first one the page still works fine. Is this a bug or a functionality ...

How to check to see if a textbox is currently active or has focus?

Hi! In C#, is it possible to get a bool value, determining if the cursor is currently inside a certain textbox? What I want to achieve: I have a masterpage, with two buttons in it; a search-button and a login-button. Depending on what textbox is active or has focus, or of none have focus, I want to set the UseSubmitBehavior-attribute....

Why Thread.Sleep() is so CPU intensive ?

I have an ASP.NET page with this pseduo code: while (read) { Response.OutputStream.Write(buffer, 0, buffer.Length); Response.Flush(); } Any client who requests this page will start to download a binary file. Everything is OK at this point but clients had no limit in download speed so changed the above code to this: while (read)...

How do you remove HttpOnly cookies?

If my application places HttpOnly cookies on a client and then needs to remove them how can you remove them completely? ...

Reference an ASP control inside a function or class method

How do you reference an asp.net control on your page inside a function or a class. private void PageLoad(object sender, EventArgs e) { //An example control from my page is txtUserName ChangeText(ref txtUserName, "Hello World"); } private void ChangeText(ref HtmlGenericControl control, string text) { control.InnerText = text;...

Improve the design of GUI/website

So i am using visual studio 2008, asp.net 3.5, with the basic toolkit provided. Now i have made the gui which a lot of functionality but the design is very basic. and looks too old. I need to give it a new look, a new feeling new designs.... like the gridview, the buttons the textboxes, the menus look basic... this is not working for...

asp.net inproc vs out of proc performance

Hi, I'm considering moving our web app session storage from In Proc to State Server. Can anybody give any figures as to the performance difference? ...

page theme causing "Failed to load viewstate." error

In my web.config I have the following: <pages theme="myTheme" enableSessionState="true" validateRequest="false" enableEventValidation="false" viewStateEncryptionMode="Never" enableViewStateMac="false"> As soon as I added the theme property I instantly started to receive: Failed to load viewstate. The control tree into which v...

what in the wierd Membership.GetUser() is not working in firefox

Hi, Membership.GetUser() is always null when I browse the app in firefox. It is absolutely working fine in IE 8.. anyone knows what could be the problem? thanks ...