asp.net

How to use image resource in asp.net website?

I have a c# site which makes use of a lot of images with embedded english text. How can I use a standard resource file to swap out images depending on the language? I have a resx file in my App_GlobalResources directory, but I can't seem to get it plugged into an asp:image control for the imageurl correctly. Ideas? UPDATE: For so...

Why doesn't User.IsInRole work in this context?

...I want to Show the 'delete' button when user is an admin, and show the 'add item' button when user is a contributor: <!-- More code above --> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" /> <asp:TemplateField ShowHeader="False"> <ItemTemplate> ...

Strategic Advice: Upgrading the Design of a Web App

I have an ASP.NET web site dedicated to reporting on PBX extension stats. It comprises many report pages, with HTML generated almost purely by code-behind (setting a Label control's Text property instead of using Response.Write), using un-parameterised string literal SQL queries that populate By Reference DataTable parameters. Maintena...

How to check the content of an uploaded file without relying on its extension?

How do you go about verifying the type of an uploaded file reliably without using the extension? I'm guessing that you have to examine the header / read some of the bytes, but I really have no idea how to go about it. Im using c# and asp.net. Thanks for any advice. ...

ASP.NET -- How to populate a TreeView control with XML data response from a ASHX handler

I have an ASHX handler that returns an XML response (FileStructureXML.ashx). Now I need to get the XML response from the ASHX handler and use it as a data source for my ASPX page. If I point the XMLDataSource to a static XML file on the server, the treeview populates as expected. However, if I point the XMLDataSource to the ASHX handl...

Get the ASP.NET form name

I'm looking for a way to get the name of the main HTML form so I can submit it from JavaScript. The reason I can just set the name of the form is because the JavaScript is on a User Control that could get added to many different sites with different form names. Thanks. ...

Security with QueryString values in Asp.net MVC

How do you properly ensure that a user isnt tampering with querystring values or action url values? For example, you might have a Delete Comment action on your CommentController which takes a CommentID. The action url might look like /Comments/Delete/3 to delete the comment with the id 3. Now obviously you dont want anyone to be able to...

IIS Worker Process using a LOT of memory?

I have one website on my server, and my IIS Worker Process is using 4GB RAM consistently. What should I be checking? c:\windows\system32\inetsrv\w3wp.exe ...

ASP.NET WebPermission Security Exception

I usually hate posting these types of questions as normally I find that the best way to really learn is to figure out the answer yourself. However, I need an answer to this question really quickly as I have a client who can't run her business due to this problem. Yesterday my ASP.NET host provider moved my application from a server ru...

How do I get an already (basic) authenticated context to call a web service behind the same authentication?

Hi, I have a site behind basic authentication (IIS6). Part of this site calls a web service that is also part of the site and thus behind basic authentication as well. However, when this happens the calling code receives a 401 Authentication Error. I've tried a couple of things, with the general recommendation being code like this: ...

What options are there for sharing data across subdomains?

I have www.example.com and also store.example.com. (Yes they are subdomains of the same parent domain) store.example.com is on ASP.NET 1.1 www.example.com is on ASP.NET 3.5 I want to know what options are available for sharing 'session' data between the two sites. I need some kind of shared login and also the abiltity to track user ac...

How do you implement search functionality using location information in ASP.NET?

I am currently looking into using Lucene.NET for powering the search functionality on a web application I am working on. However, the search functionality I am implementing not only needs to do full text searches, but also needs to rank the results by proximity to a specified address. Can Lucene.NET handle this requirement? Or do I ha...

How does SQL know what @p# in LINQtoSQL queries?

I want to know how does the SQL Server know what @p# is in say this LINQtoSQL quey SELECT [t0].[MemberID], [t0].[Aspnetusername], [t0].[Aspnetpassword], [t0].[EmailAddr], [t0].[DateCreated], [t0].[Location], [t0].[DaimokuGoal], [t0].[PreviewImageID], [t0].[LastDaimoku] AS [LastDaimoku], [t0].[LastNotefied] AS [LastNotefied], [t0].[La...

Export SQL database to Access - ASP.NET

Is there any way to export data (not necessarily schema) to an access database via asp.net? The server has no office components installed and the process must occur via a webpage (like an excel export). ...

Problem ASP.NET Img tag

Hi, I have a problem with how ASP.Net generates the img tag. I have a server control like this: , asp:Image runat="server" ID="someWarning" ImageUrl="~/images/warning.gif" AlternateText="Warning" /> I expect it to generate this: img id="ctl00_ContentPlaceHolder1_ctl00_someWarning" src="../images/warning.gif" /> but instead it generat...

Looking for a Report Designer that allows connection to a RESTful webservice

Hi, I'm looking for a Report Designer that will allow me to connect to a RESTful webservice. Ideally I would like one that has a royalty-free End-User Report Designer. WE will be hosting it in an ASP.NET web site. So something compatable with that would be ideal ;) We used to use Data Dynamics Active Reports. However this doesn't allow...

Detect when JavaScript is disabled in ASP.NET

In the Render method of an ASP.NET web-control, I need to alter the output of the Html based on whether JavaScript is enabled or disabled on the clients browser, Does anyone know the right incantation to figure that out? ...

Application Pools not starting after iisreset

Before I start, I know using iisreset is considered bad practice, but this shouldn't happen anyway.. What we have: Several machines with IIS6 on Windows Server 2003 R2 (both 64 and 32 bits) Several WCF webservices (.NET runtime 2.0) deployed in several applications, each with it's own application pool, each application pool running un...

How to gracefully check whether Gravatar, or third-party website, is working or not?

I just posted the question how-to-determine-why-the-browser-keeps-trying-to-load-a-page and discovered that my problem is with Gravatar. I also noticed that StackOverflow is suffering from the same outage. Does anyone know of a graceful way to determine if Gravatar, or any third party website for that matter, is up or not, before t...

Dynamically adding Content blocks to Masterpage fails after Master.FindControl

Hi all, I've encountered an odd problem that doesn't make any sense to me. I am trying to dynamically set up MasterPage Content controls on a page. I have it working nicely with the following code: protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); MasterPageFile = "~/MasterPages/Default.master...