.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Splitting functionality into dlls/separate code files

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

I'm trying to get a simple website up and running, and I'm new to asp.net.  I have:


  • default.aspx
  • default.aspx.cs
  • app_code
  • utils.cs
I'm trying to get code referenced in my utils file into the default code file.  When i "run" the webpage from within VS2008, everything works as i would expect, but trying to navigate directly to the http://localhost/test/default.aspx page, (using IIS, instead of whatever VS uses), it fails, saying that it didn't understand any references to the utils.cs
I've also tried rearranging the project so that utils.cs compiles into a dll, but this didn't work either - I could see the dll in my bin directory, but it wasn't linked in automatically (looking at the error, it was obvious that the dll wasn't included in the compiling of the aspx page)

View Complete Post

More Related Resource Links

Code Name WinFS: Revolutionary File Storage System Lets Users Search and Manage Files Based on Conte


One of the monumental problems organizations face today is aggregating information that's stored in disparate formats. Knowledge workers have long wanted to be able to search for content independent of format. The next version of the Windows operating system, code-named "Longhorn," boasts a new storage subsystem that makes that task easier. That subsystem, code-named "WinFS," allows the user to perform searches based on the metadata of the stored item, regardless of what type of file it is or which application created it. This article covers the basic architecture of WinFS and explains how to use the WinFS managed API.

Richard Grimes

MSDN Magazine January 2004

External Code Assemblies, Report Subscriptions, and configuration files

I've got a report that relies on a very small external assembly for data for one of its fields.  That assembly, in turn, relies on some values from System.Configuration for portions of its work. I have the configuration keys and values running fine in the web interface, set up in web.config, but when users set up subscriptions for the report it runs fine but doesn't retrieve the configuration values from web.config (as expected) nor does it retrieve them from rsreportserver.config, where I have tried them in the root of the config file as <add key=... /> entries and also by wrapping them inside an <appSettings /> node.  I have also tried them in an appropriately-name config file in the bin directory.  In all cases the report is fine except the field that relies on the external assembly, where I recieve an error indicating that there's missing information (the config vals are used in a String.Format() call): Value cannot be null. Parameter name: format at System.String.Format(IFormatProvider provider, String format, Object[] args) at ExternalDBFunctions.ExternalSelectors.GetNotificationStati(String NotificationID) mscorlib When I remove the config values from the web.config, the web interface shows exactly the same error. Where should these configuration values go?

Data from text files, What's wrong with my code?

Hi all, I have uploaded some tab-delimited .txt files on my web site (actually run on my computer, ie localhost, for now), and now I try to retrieve the data from those files. I do this by calling a vb file containg the sub below. Everything works great, except that the sub won't recognise unicode characters. I can split the resulting string using vbnewline and vbtab, but already in the sub in question, the string doesn't understand the Swedish letters åäö, apostrophes and more. Any help would be greatly appreciated! /Pettrer       Shared Function getTextfile(ByVal FullPath As String, Optional ByRef ErrInfo As String = "") As String Dim strContents As String = "" Dim objReader As StreamReader Try objReader =New StreamReader(FullPath) 'UTF8Encoding? strContents = objReader.ReadToEnd() objReader.Close() ErrInfo = Ex.MessageCatch Ex As Exception End Try Return strContents End Function  

Uninstall error -- The timestamp marker on log files has been set. Error code 0x84B20001

I need to uninstall from the command line for an application we are writing SQL Express 2008.  I am using the following command to debug an error message,   setup100.exe /ACTION=UNINSTALL /INSTANCENAME=SUNKIST /FEATURES=SQL   and I keep on getting an error message:   SQL Server Setup Failure The timestamp marker on log files has not been set.  The timestamp must be set set prior to it being used for the first time.  Error code 0x84B20001   the log files seems to have problems in the following area,    Running Action: SaveFeatureStateAction2008-10-01 15:00:51 Slp: Completed Action: SaveFeatureStateAction, returned True2008-10-01 15:00:51 Slp: Completed Action: ExecuteUninstallCalculateWorkflow, returned True2008-10-01 15:00:51 Slp: ----------------------------------------------------------------------2008-10-01 15:00:51 Slp: Running Action: ProduceStatusLogs2008-10-01 15:00:51 Slp: Error: Action "ProduceStatusLogs" threw an exception during execution.2008-10-01 15:00:51 Slp: Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: The timestamp marker on log files has not been set. The timestamp must be set prior to it being used for the first time. ---> Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException: The timestamp marker on log files has not been set. The timestamp must be set prior to it being used for the first time. --->

write server side code in External JS files

Salam To All,for my JS code, some times i need to organize my code, so i prefer to put some of javascript functions in external js files and  include it in my page as well.but i am face a problem if i need to write some .Net code especially to Get the Client ID for any of .net controls.so do you have a way to write the following code in External JS file?('#<%= this.ddlMake.ClientID %>').change(function(

Issue with designer files not updating -- and therefore cannot code



I have a problem in which some nested controls on a page are not updated in the designer file. I have deleted the designer file, selected Convert to Web Application, but still the controls are missing.

I know there is a supposed fix at http://blogs.msdn.com/b/webdevtools/archive/2010/03/05/hotfix-for-issue-with-auto-generated-designer-files-not-adding-controls.aspx

Unfortunately the patch won't install and I still have the issue.

Any thoughts? I am running VS 2010 Version 10.0.30319.1 RTMRel.



Setup file(*.msi) also includes .aspx.cs (source code) files also


My project is recently migrated from 2008 to 2010

actualy we developed project in VS 2005 in that we created setup file but when we migrated to vs2008 setup file giving problem to us.

now when we make setup file it is including .aspx.cs files also but this if we publish our project it wont including source code.

why setup file including .aspx.cs files is there any way to change.

plz replay ASAP

How to use 2 xaml files with one code behind


Hi all,

I am developing a SW that can automatically detect the render ability of current machine then decide what GUI file is loaded. At this time, I have to create these files:

1. HighResGUI.xaml + HighResGUI.xaml.cs

2. LowResGUI.xaml + LowResGUI.xaml.cs

Both HighResGUI.xaml.cs and LowResGUI.xaml.cs are the same, only the xaml has different styles (due to the render capability of the current machine). This can solve my problem, at this time. However, when I want to modify one xaml.cs code, I have to do it twice for both High and Low.

So my question is, how can I combine these two different interface (HighResGUI.xaml+ LowResGUI.xaml) and use only one code behind, for example common.xaml.cs?



how to get files in vb.net in all directories.I had written the code.if u see in the detaild message


This is in class file
Imports Microsoft.VisualBasic
Imports System.IO
Imports System.Collections.Generic
Public Class FileSrch
'' File Search Options
Public Enum FileSearchOptions
End Enum

Public Shared Function GetSearchcriteria(ByVal DatetoSearchwith As Date, ByVal Filename As String, ByVal FileExtension As String, ByVal SearchOptions As FileSearchOptions)

Select Case SearchOptions
Case FileSearchOptions.YearFirst
Return String.Format("{0}_{1:yyyyMMdd}{2}", Filename, DatetoSearchwith, FileExtension)
Exit Select
Case FileSearchOptions.MonthFirst
Return String.Format("{0}_{1:yyyyMMdd}{2}", Filename, DatetoSearchwith, FileExtension)
Exit Select
Case FileSearchOptions.NormalFiles
Return String.Format(Filename + FileExtension)
Case FileSearchOptions.DateinExtension
Dim ExtensionFormat As String = (Convert.ToInt32(DatetoSearchwith.ToString("mm")).ToString() & DatetoSearchwith.ToString("dd"))
'' Month in Double Digit
If DatetoSearchwith.Month > 9 Then
ExtensionFormat = (DatetoSearchwith.ToString("mmm")(0) & DatetoSearchwith.ToString("dd"))
End If
Return String.Format("{0}.{1}", Filename,

"Place code in separate file checkbox" is not showing up



I have a strange problem.

When I create a new webform in my projects I cant see the checkbox "Place code in separate file".

Instead VS2008 automatically creates a webform and a codebehind file.

I used to be able too see the checkbox, but one week ago or so, it just disappeared.

I want to be able to use inline code in my projects. Anyone have a clue what the problem might be?

How to run code in a separate process


I am not sure exactly which topic this post should go under...

Here is what I am doing.

I have a web form where a person will edit their blog article. At some point, once they are done editing, they can click a button "Publish Blog Now".

Once the blog is published in the click event on the server side I am doing a query to get a list of subscriber email address.

These are people who subscribed to this blogger and wish to receive an email notification whenever this person publishes a new blog.

What I just realized today is that my hosting provider only allows me to send a maximum of 200 emails per hour. Which means in my loop I need to sleep for roughly 20 seconds between each email notification sent. But I dont want the user who clicked the publish button to have to sit there and wait while that process is going.

How can I return to the user but yet continue to run some code on the server side to send out the emails in the background even if user closes web browser?

This is an ASP.NET web application targeting .net 4.0 and I am using c# as my back-end language and VS2010 as my development tool.




Separate javascript files with shared cshtml views in MVC3


We have a shared CSHTML view file with a javascript file include that many of our views use:
<script src="@Url.Content("~/Scripts/customJavascript.js")"

Clean Web.Config Files (VS 2010 and .NET 4.0 Series)

.NET 4 includes a new version of the CLR, and a new .NET 4 specific machine.config file (which is installed side-by-side with the one used by .NET 2, .NET 3 and .NET 3.5).

The new .NET 4 machine.config file now automatically registers all of the ASP.NET tag sections, handlers and modules that we've added over the years, including the functionality for:

.ASP.NET Dynamic Data
.ASP.NET Routing (which can now be used for both ASP.NET WebForms and ASP.NET MVC)
.ASP.NET Chart Control (which now ships built-into ASP.NET V4)
What this means is that when you create a new "Empty ASP.NET application" project in VS 2010, you'll find that the new default application-level web.config file is now clean and simple:

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

You Can Find Useful ASP.NET Related Posts on the above link.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend