asp.net

Override ASP.NET forms authentication for a single page

In our ASP.NET MVC application, we automatically redirect users to a log-on page via the <authentication> section of <system.web> when they attempt to access an authorized-only page. The problem is that one action in the middle of the application, designed to be used by a tool, needs to return a straight-up HTTP 401 response on bad acce...

I assume SqlParameter.IsNullable only makes sense when…?

1) When SqlParameter.IsNullable is set to true, received null value is converted to DBNull.Value and sent to database. Thus I would assume setting IsNullable to true only makes sense when GridView’s Parameter.ConvertEmptyStringToNull is also set to true? 2) Both GridView’s and ObjectDataSource’s parameters have a ConvertEmptyStringToNul...

Asp.Net Modal "OK" is triggering validation... How can I stop that?

I have a pop-up modal that is displayed as soon as anyone visits a page (on page load). The modal is an agreement they must accept to continue. The problem is, when they click accept, it triggers all the client side validation, displaying all the error messages. I obviously don't want this to happen as the user hasn't even gotten a ch...

What is the best practise design for a scalable web application involving session state

The reason I ask this is recentlydesigned an application , initially wanted to use no session state to keep things simple, but eventually succumbed to the ease of the session state idea for storing state. I was aware that moving to a web farm solution would involve configuring session state to run in sql. However I had never run across a...

Define a typed dataset dynamically?

I am trying to create an instance of a typed dataset dynamically in my code at runtime. I have the type available to me, but when I try to do this: object obj = Activator.CreateInstance(Type.GetType("TYPED DATASET TYPE HERE")); The problem is the type doesn't seem to be valid according to the code when I try and run it. What could I b...

C# MVC: ViewModel Base Class (for Master Page Information) ?

How would you push strongly typed information in MVC to the master page? Would you have a ViewModelBase class that contains master page information and inherit from it for every view model, or is there a better approach? Thanks :) ...

MasterPage using Masterpages, and inheritance

I've got a "Master" Masterpage, and I've got 2 "Sub" Masterpages. Those 2 subs have their masterpage property set to the "Master" Masterpage. All good so far. Well, I was told today to also make Sub1 and Sub2 actually "inherit" from the Master Masterpage. I thought they were being imprecise with their language, but no, she wanted me ...

Performance testing strategy web app

We recently had a web app that went out to site acceptance testing where they found severe performance problems related to request size (massive viewstate ASP.net). We need to ammend our testing strategy to include performance testing, can anyone give us guidance on best practices please? ...

Why a simple <% Eval() %> will work in IE and Chrome and not in Firefox?

The code below: <asp:HyperLink ID="Image1_Link" runat="server" Text='<% "< img src=" + PhotoGalleryBaseUrl + Eval("image_file_name") + ">" %>'> </asp:HyperLink> Image Size: <asp:Label ID="image_sizeLabel" runat="server" Text='<%# Eval("image_size") %>'> </asp:Label><br /> Renders like this in Chrome and IE: And renders like this i...

problem with LINQ, I dont know what is it !

I moved my project from my computer to athor computer and when I opened it, I facing this problem with LINQ: http://www.rofof.com/img2/6bvnql3.gif pleas how can I solve it ? ...

ASP.NET Cache - circumstances in which Remove("key") doesn't work?

I have an ASP.NET application that caches some business objects. When a new object is saved, I call remove on the key to clear the objects. The new list should be lazy loaded the next time a user requests the data. Except there is a problem with different views of the cache in different clients. Two users are browsing the site A new ...

Overwrite the header output of an ASP.NET gridview control

Is there an efficient way to overwrite the HTML output of a header and footer of an ASP.NET GridView control? I would like to implement a methodology that is similar to the HeaderTemplate tag in an ASP.NET Repeater or does not require to include dynamically building the HTML output in the page code behind. If these two types of option...

Using ProcessModelInfo with IIS 6.0

I want to use the information obtained by calling System.Web.ProcessModelInfo.GetCurrentProcessInfo(). But MSDN says this method can only be used with IIS 5 or IIS 6 with IIS 5.0 isolation mode. I do not want to use IIS 5 isolation mode. Is reading from Performance Counters the only way around? ...

Attach Hiddenfield to HTML Markup

Hi All, I am attaching an object to my aspx page. Since the object's type is determined at runtime, I want to be able to set the value of this object's type parameter to a hiddenfield value which I set when I run my web application. <asp:HiddenField ID="hiddenField1" runat="server" /> <object id="myObject" type="hiddenfield1.v...

Allowing user to edit / add / move items in an image

Here's what I'm looking to do: I have an image, let's say of a room. This is going to be a static image. I want the user to be able to do the following: 1. add a set of images, like a chair, desk, etc. 2. move items which are already on the image. 3. edit text attached to an image. I need this image to be stored on the server, as wel...

Login failing on live server - asp.net

Hi All, I am new to asp.net and am trying to test my first site on a production server. What I have is a login control "login.aspx" that after successful login redirects the user to an admin area of the site. When I test the site using VS2008 on my Windows XP machine all works well and I can login and administer the site. I am using Fo...

How do I prevent adding same event in Asp.net page?

I have been write code in Page_Load function like this protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { UserControl1.Button_Clicked += new EventHandler(UserControl1_Button_Clicked); } } But the same function will be added again when the page is directing to this page from the other page. Is...

404 Error w/ ASP.NET MVC Routing on ISP

I have a simple ASP.NET MVC 1.0 site w/ Home, Upload, and About links based upon the default project template for an ASP.NET MVC Project. The Global.asax.cs has the following route. routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", ...

Problem validating filetypes in an ASP.NET FileUpload control with RegularExpressionValidator

code: <span>Upload Adobe Acrobat file<img src="../../Images/UI/pdf.jpg" style="height: 25; width: 20" height="25" width="20" /></span> <asp:FileUpload ID="uplPdf" runat="server" /> <asp:RegularExpressionValidator ID="valPdf" runat="server" ErrorMessage="Only PDF files are allowed!" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\...

ASP.Net search subdirectory

How do I search a sub directory in my ASP.Net web site? I know if this was a regular Winform project, I could easily get it by the following: Environment.CurrentDirectory or System.IO.Directory.GetCurrentDirectory() then string[] directories = System.IO.Path.Combine(Environment.CurrentDirectory, "Portfolio") How do I build the ...