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

Post New Web Links

Seemingly simple URL rerouting problem

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net

// ** URL ROUTING **  
private static void RegisterRoutes(System.Web.Routing.RouteCollection routes)  
  routes.MapPageRoute("Subsite", "{SubsiteName}", "~/Content.aspx");  
  //routes.MapPageRoute("About", "About", "~/Content.aspx");  
  //routes.MapPageRoute("Conferences", "Conferences", "~/Content.aspx");  
  //routes.MapPageRoute("PoliticsPortal", "PoliticsPortal", "~/Content.aspx");  
I am trying to register my routes as above, using a single routes.MapPageRoute() statement to cover all locations of the form www.mysite.com/subsiteName; however, I encounter all sorts of bizarre browser errors relating to my use of client-side AJAX.  If instead I use a separate "hard-coded" statement for each route, it all seems to work.

I have noticed that examples for this on the web (e.g. http://msdn.microsoft.com/en-us/library/cc668177.aspx) all seems to have at least two components in the URL path; e.g.,

routes.MapPageRoute("SalesSummaryRoute", "SalesReportSummary/{locale}", "~/sales.aspx");  
It is possible to do what I'm trying to do, isn't it?  Is there something fundamentally wrong with my approach?

View Complete Post

More Related Resource Links

simple wfc and ajax problem

Good day,I wrote a very basic hello world wfc/ajax solution.C#public string sayHello(string name)    {        return "Hello " + name;    }JS:function go() {            tempuri.org.IService.sayHello("John", OnSuccess());        }        function OnSuccess(r) {            document.getElementById("result").innerHTML = r;        }All the plumbing is pretty much what all the dev sites say...but I am getting a curious result.If I put a break in OnSuccess and in sayHello functions. The onSuccess is hit before the sayHello - both are hit though so the wfc seems to be working its just that the onSuccess is being called straight away rather than after the return from the server.Help appreciatedKalCODE:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">

best approach to a simple problem.

let me preface this with saying, i dont really know css or javascript or even xml really. i know enough to do what i need to, i dont know best practices, i can just get it done, so im aksing this to make sure the way i plan on doing this is a good way. just need to be pushed in the right direction. so im looking to make a simple webpage (client side only) that allows a user to pick colors for a IDE (think Visual Studio) so what i want to do is show a segment of code that shows something of all color types.. so think of a code segment like this response.write "hello world" there could be 4 different colors in this... the object, response, the period (it has a name, i forget it), the member, write, and a type, string.. so what im thinking is that there is some text on the page and a drop down that lets you pick the type to color, and then the color... so im thinking to use div tags to identify each type <div id=object>response</div><div id=period>.</div> etc etc and then do an on change for the color drop down to update the colors.. so i can do that, but the question is, im wanting to use CSS/XML so that way, if i get a couple of themes, i can then add a theme drop down to show some premade setups... default.xml <options> <object>red</object> <period>black</object>

Simple GUI problem

So I don't know what's going on, but when I try to select a control (a textbox in my case), it only selects the lowest level control.  What I mean, is that if there is a grid, with a second grid inside, with a textbox inside of that grid - I am unable to left click the text box.  When i right click->select, it doesn't even give me the option to select the text box.  The only way I'm able to do it, is through the document outline, which is a pain. Any info will be much appreciated thanks, Phil  

Simple CSS alignment problem



Im trying to create a page with css layout instead of tables.

I want to create a div that is 100% long, and contains three buttons (maybe more?). The first button should be placed to the left, the second in the middle, and the third to the right. They shall, of course, be placed on the same horizontal line.

How to do this with css?

Thanks alot :)

Kind regards,


JQuery - Simple Cookie problem


Hi everyone,

The following code does not work as I expect.  If possible, please fix the following code for me.



var shopping_cart_id = $.cookie('ASP_NET_4_WEBSITE_3_ShoppingCartId');
if (shopping_cart_id == "") {  // not sure ????
shopping_cart_id = guid();
//Create (or update) the value of a cookie to expire in 30 days:
$.cookie('ASP_NET_4_WEBSITE_3_ShoppingCartId', shopping_cart_id, { expires: 30 });




simple css problem


All I'm trying to do is display a line in my header with 4 elements like the following:

 Case ID:   130                                                                                             Original Input: xxx

No matter what I try however, the "xxx" part always displays below the "Original Input" instead of to the right of it.

Following is my code; I've spent an inordinate amount of time on this and I'm hoping it's just something stupid I'm missing. I'd greatlly appreciate any suggestions.


<head runat="server">
    <style type="text/css">

Simple Calculation problem



I am doing a very simple calculation that is not giving me the correct calculation and I don't know why. Here is my code:


float abc;
abc = 0;

for (int a = 0; a < 1184; a++)
  abc = (a + 1) / 1184 * 100; // This is percentage of loop completed

But as this loop loops through, the value for abc is zero the entire time. I've tried using different variable types for abc (i.e. int, float, double) but it makes no difference.

When running this code:


for (int a = 0; a < 1184; a++)
  abc = (a + 1) * 100; // This is percentage of loop completed


the values appear as they should: 100, 200, 300, 400, ect


Why when dividing by 1184 the values automatically become zero?

Problem with simple query



I have a problem with a query. I want to check the field confirm_date if it contains a value or null. If it contains a value I want to do an insert statement.

The query looks like so,



case confirm_date
when is not null

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

A Simple and Extensible Radio Button Style GridView

The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.

Silverlight Simple Animation

Silverlight has several built in techniques for animating controls. Many of these technologies are particularly useful for creating simple animations meant to decorate a web page with eye catching movement that draws the reader's attention. In this post I will skip over these decorative technologies, and instead show how to create a simple animation using a technique similar to those used in many games.

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

Hi friend,

you can use this thread to solving problem and solutions.

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http

Strange Photo upload problem


I'm working project it's live on shared hosting

we'er uploading photos to a file on the server everything works fine the photo is resized renamed and sent to the folder

the upload page returns the thumbnail and the full size photo it's there all the photos have to be approved by an admin

twice now after they have been approved they disapear I checked the folder they are not there could there be anywhere

on the server they could get hung up before they go into the folder I have it setup so when you delete the data base entry it deletes the photo from the folder othe than that you need to open the folder and delete the photo this has hapened twice now I tried to recreate it with no luck

thaks for your help in advance

I thought this would be simple... Trying to create a login does an ajax check before submit


I have the standard .net login control that is working.  (Still learning .net after 15yrs of classic)

What I want to do is OnButtonClick run a javascript function (to do an ajax call to the db to check if login is valid or not) and if it returns true, then submit the form normally, else don't submit. The piece that I can't figure out, is how to correctly override the default click even to hit my JS routine and then submit the form properly afterwards.

Thanks ahead of time

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