asp.net

T4 templates newbie question

I am building a product, and I need a way to generate code at the runtime. Currently, I use VB.Net (only for this and nothing else) xml literals (is that what they are called?), to create templates and create code at runtime. My question is, can I use T4 on web server in shared hosting, without VS installed, to generated code at runtime?...

Is there a way to determine if a redirect occurrs during a WebRequest?

I'm using HttpWebRequest to scrape Wikipedia.org. A lot of times there will be links to topics on a page that have been consolidated and therefore they redirect you to the correct page. for example http://en.wikipedia.org/wiki/Polish_prisoners_of_war_in_Soviet_Union_(after_1939) redirects you to the correct topic which is http://en....

ASP.NET Membership Redirect User on Denial of Access

I want to redirect the user to a custom error page when s/he is denied access to a page because of ASP.NET Membership's Roles. I thought this could be solved by the customErrors section of the web.config file, but none of the errors I've tried has caught it. In other words, if a user is in the role "Project Focal" access, and tries t...

ASP.NET exception "Thread was being aborted" causes method to exit

In the code below, sometimes someFunctionCall() generates a "Thread was being aborted" exception. How come the code in code block B never runs? Does ASP.NET start a new thread for each method call? I was suprised to see that when this exception happens the code in block b never runs, the method returns, and my application keeps running. ...

ASP.NET next/previous buttons to display single row in a form

Hi, I'm looking for the best way to implement this in ASP.NET. On the page, the user has an option to "page" through subscription numbers with next and previous buttons. When the user clicks the next/previous buttons, the page is posted back (partial, AJAX) and the subscription details is displayed in a form. There is only one row dis...

Since there is no Sqlserver array parameter, what's the best way to proceed?

I need to create multiple records in sqlserver, each with the same value in column A, but with a unique value in column B. I have the values for column B in an array. I am using VS2008, aspnet, c# 3.5, sqlserver 2005. Am I better off Option 1. Making 1 call to a stored procedure in sqlserver from c# code, and then doing all t...

HTML.Encode() - What/How does it prevent scripting security problems in ASP .NET?

What security protection does HTML.Encode() afford me when I'm dealing with user input, specifically scripting problems? ...

Is there a generic way to get a Linq2SQL Entity by its primary key?

Ok, the short version is that I have a Linq entity from a LinqDataSourceUpdateEventArgs and I need to handle the Update manually because MS was stupid. I can get the Table object from the data context, which allows me to, well, this: var newObj = e.NewObject; var table = FormContext.GetTable(e.NewObject.GetType()); table.Attach(newOb...

GridLines not showing in a GridView with CSS reset?

I have a page which includes a css reset. On that page, I have a gridview with the GridLines="Both" property set to true, but the grid lines are not appearing. If I remove the css reset, the gridlines show up. This is only happening in IE. I want the reset and I want the gridlines to appear. Does anyone know the solution to this? ...

How to read an ASP.NET internal server error description with .NET?

Behold the code: using (var client = new WebClient()) { try { var bytesReceived = client.UploadData("http://localhost", bytesToPost); var response = client.Encoding.GetString(bytesReceived); } catch (Exception ex) { } } I am getting this HTTP 500 internal server error when the UploadData method ...

Web.config override doesn't affect user controls.

I have a sub folder that has an aspx page and a web.config file that overrides a connection string in the web.config in the root directory. The problem is if the aspx page contains any user controls the user controls still get the connection string from the web.config in the root directory. Is there anyway to force them to use the web....

How do you centralize UI across multiple ASP.NET sites?

One of the projects I was in charge of as a JSP/Struts developer at my last employer was a themes tag library (present on every WebSphere server as a shared library) that let any Java web dev in the company pull in any of the standard themes like intranet, public, etc. with minimal effort. The themes included header, footer, navigation, ...

IIS vs. ASP.NET authorization - easiest way to secure static files?

Let's say I have the following in a web.config: <allow roles="Developers" /> <deny users="*"/> This locks down access on .aspx, .asmx, and other .NET file types, but it's still allowing unauthorized users to open static files like image.jpg. I understand why the web.config isn't asked for authorization information when someone asks f...

Why won't windows explorer sort directories under the 'Temporary ASP.NET Files' directory by name?

When I navigate to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\myfirstproject\202aebd2\f0e764e2\assembly\dl3 in Windows explorer, there are 108 folders with 8 character hexadecimal names. Explorer won't sort this folder by name (or value ). What gives? ...

Passing Listbox Text to Javascript Pop-up Window URL

Hello: Is it possible to pass the contents of a textbox or Listbox into the URL portion of the javascript code window.open(URL)? I have an asp.net listbox control that displays URL values. When ever an end user clicks on another listbox, the URL listbox provides the specific URL. I am trying to pass this URL into the above javascript...

Are there any .NET content management systems that focus on usability and leave out the bloat?

I work in a shop that is mostly .NET based, and we're trying to pick out a content management system to use. This means we mostly likely won't be able to use any of the common open source CMS projects (Plone, phpNuke, anthing not based on .NET, etc.). Since I'm a huge usability nerd (just finished reading The Design of Everyday Things b...

Timing User Access in ASP.NET MVC, Beginner

In ASP.NET MVC, what is a good way (the preferred way??) to time how long a user has been on a specific page? For example, I want the user to select something and then only allow the user to do something for 30 seconds. Good links or a reference to a page of a book would be much appreciated. Thanks in advance! ...

How Can I Remove Access Db's temporary ldb file

I have an ASP.NET Project. I am connecting to the DB and then closing and disposing of the connection object. But when anyone enters my site, MS Access creates a temporary dbname.ldb. When I want to download my original mdb file from my server it won't let me access the mdb file. I can't do anything if there is ldb file in server. It's l...

how to check what platform a site is running?

what can i do to check what platform a site is running, whether it's asp.net, and what kind of database engine it's using, and any other tools that are running? (given that it is not my site and i dont have access to it) ...

ASP.NET: "Object Required" when repeating LinkButtons in an UpdatePanel

I have an UpdatePanel which has a Repeater repeating LinkButtons. When I click a LinkButton, the page does a partial postback, then I get a javascript error: "Object required". I tried debugging the javascript, but couldn't get a call stack. If I remove the UpdatePanel, the LinkButtons do a full postback, and they disappear from the ...