asp.net

How can I correctly rewrite a URL with .aspx to a URL without .aspx?

I have a site that currently uses the .aspx extension on its pages. It's getting a Joomla conversion and the .aspx extension will not work anymore. I need it so that if someone enters the .aspx extension, it will just get removed the URL so none of the SEO on the current site breaks. For example, I need www.arrc.com.php5-17.websitetestl...

Export iQueryable of complex objects to Excel

We have some code that exports data from a database to Excel and it works well. The main problem is we use a DB view to gather all our data. This creates the issue of having a sizable view as we have multiple types of objects of which we export. class Event int id string title List<EventDate> Dates string desc class EventDate...

Why does HttpContext.Current.Request.Url.AbsolutePath return an empty string?

When user requests http://localhost/WebApp1/Default.aspx, txtApplicationPath.Text should be assigned “/WebApp1”, while txtAbsolutePath.Text should be assigned “http://localhost/WebApp1/Default.aspx”, but instead both textboxes display empty strings. Why? Default.aspx: <asp:TextBox ID="txtApplicationPath" runat="server" Text='<%...

Is there a secret to using LINQ to SQL to add records when the object has relationships?

I am working in LINQ to SQL, ASP.NET MVC, and C#. I have a repository called genesisRepository to connect to the database. I have a table represented in an object called Stream. It is defined like this: [Table] public class Stream { [HiddenInput(DisplayValue = false)] [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync...

ASP.NET Metatag element

Im trying to add metatag programatically to my page in asp.net using: HtmlMeta meta = new HtmlMeta(); meta.Name = "keywords"; meta.Content = "test,test1"; this.Master.Page.Header.Controls.Add(meta); but the Master.Page.Header is always NULL. Any ideias? ...

How can I set a ListView's selected item based on it's ID in a query string on page load?

Question basically crams it all in... I'm loading a page with a querystring (ID), and I need to use that ID to set the selected item of a ListView when the page loads. The ID is a DataKey on the ListView. Please help! I have no code of value to post--none of my attempts at this work. ...

regular expression: mine text data from other websites.

Hi, I want to crawl through lets say other companies websites like for cars and extract readonly information in my local database. Then I want to be able to display this collected information on my website. Purely from technology perspective, is there a .net tool, program, etc already out there that is generic enough for my purpose. Or...

ASP.NET Gridview - How to display Headers to the left?

I need to display the column headers to the left within ASP.NET? Any ideas on how to do that? ...

ASP.NET Custom Control - What is the best way to include embedded CSS reference only once?

The problem: I am embedding a CSS file into a custom control library with several controls. I want to share the same CSS file for all of the controls regardless of how many instances of them are on a given form. When more than one control is on the form, I would like exactly 1 reference to the CSS file in the HTML header of the ASP.NET p...

Why isn't "renderAllHiddenFieldsAtTopOfForm" not working?

In a .NET 4 web application I've set the property "renderAllHiddenFieldsAtTopOfForm" to "false" in the web.config. Unfortunately the hidden fields are still at the top. Why is this? Does some other setting override it? "pages" property in web.config: Screenshot of top of the form: ide it? ...

change windows service password

I am having problems getting the code to change the password of a service of windows provided. Is there an easy way to do this. i got this link but it seems to be incomplete link text here they have not declared SC_MANAGER_ALL_ACCESS, m_pServiceHandle any suggestions?? thanks ...

match files to dll

say you have a huge compiled asp.net site on a live server and a development server. you make changes to a few files on dev and compile...now you want to publish those changes without copying up the whole site...just compiled stuff in /bin that has changed. anyone know of a good way to automate this? was thinking would be nice if you ...

hide modalpopup from IFrame

Hi I have a asp.net ajax app. I have one modelpopup that shows a IFrame and inside Iframe I show one asp.net page. I want to hide the modelpopup when user click on close button in page inside IFrame. How can I find the opener modalpopup? Thanks ...

JavaScript minifier (e.g. YUI) integrated to ASP.NET Webdeploy Publish

I have a javascript file that I minify using the Yahoo YUI. When I 'Publish' the web application project, I want it to only copy the .min.js file and not the original one too. I can use a pre-build event to create the minified version, but how do I prevent 'Publish' from copying the non minify file? I suppose I can 'exclude' the origina...

Database Dependent Caching w/ Multiple Databases/SqlServers

I'm working in an environment where a single web application (running in a web-farm) dynamically connects to different SQL Server databases (possibly on different servers) based on user selection (this part is non-negotiable, unless you can gift me $1,000,000 and/or some kind of time altering device). I'd like to cache some of the commo...

Update Panel in Internet Explorer Sys.WebForms.PageRequestManagerParserErrorException

My website current is in C# .NET 3.5. So the main structure of the website is like so: A Master Page has a menu bar using jquery up top and below that, a ContentPlaceHolder encapsulated with an Update Panel so the content in the ContentPlaceHolder can update without the whole page flashing. Depending on the page you go to and the 'mode...

Sum the difference of two columns in Entity Framework

I am trying to compute the sum of the difference of two columns: var result = model.TableExample .Where(condition here) .Select(s => s.Column1 - s.Column2) .Sum(); but it is rising an exception: Index and length must refer to a location within the string I can't understand th...

Why this.Page.Master is not working when I set the MasterType?

I have an aspx page which is linked to a MasterPage. If I write "this.Master" Visual Studio autocopletes the MasterPage's properties and I can access its properties. But If I write "this.Page.Master" Visual Studio does not autocomplete and I also get a compilation Error when I try to use any MasterPage's property because it is not reco...

ASP.NET MVC passing Model *together* with files back to controller

Ok, I've been going at this for several hours and I simply cannot find the solution. I want to get some data from my user. So first, I use a controller to create a view which receives a Model: public ViewResult CreateArticle() { Article newArticle = new Article(); ImagesUploadModel dataFromUser = new ImagesUploadModel(newArticl...

How can I store a UserID and Name with the LoginControl?

I have a LoginControl that works great, however, I want it to store more information than just being authenticated or not. I would like to store the UserID of the user so when they make changes I can call that UserID and record that they made the changes. Here is my code. Dim db As New DataClassesDataContext Dim User = (From ...