MVC :: Routing Displaying Different Pages With The Same Url With Optional Parameter?

May 27, 2010

I would like to have two different welcome pages for a site.How could I handle this? I've looked at routing but I'm not sure if global.asax.cs is the correct place to place this into.

www.mycompany.com should display generic information. Displaying view Home/Default.aspx
www.mycompany.com?id=1 should display welcome customer x. Displaying view Home/Welcome.aspx

View 2 Replies


Similar Messages:

.net Mvc Routing With Optional Starting Parameter

Sep 4, 2010

I'm starting a port of an existing ASP.NET Web Forms CMS to ASP.NET MVC and want to get the routing right from the start.Note: it isn't important to have the exact same URL structure.I think this answer is close to what I'm looking for but would like some additional input should anyone have it.

?Content=News/CurrentNews/This_is_a_news_article
?Content=Corporate/About_Us/Overview
[code]...

View 1 Replies

Web Forms :: Possible To Define A Parameter As Optional In URL Routing Using Web Forms 4

Jun 3, 2010

I'm trying to have a parameter as optional i.e. /Category/{ProductName}/{ProductOption} where ProductOption is optional. How do I handle this in web forms 4? Here's what my code looks like now:

[Code]....

View 3 Replies

.net MVC Routing To Controller With Optional Parameters

Apr 9, 2010

I have a controller method that is called with many different combinations of URL's. To overcome issue i am using optional parameters.here is my controller method signature...public ActionResult localMembersSearch(string Gender, string calling, [Optional]string Region, [Optional]string County, [Optional]string Town, [Optional]string queryvalues)the first two parameters are not optional but always expect

View 1 Replies

.net Webforms Routing Optional Parameters

Sep 23, 2010

I want to add optional parameters in my routing table.For example I would like the users to browse a product catalog like this:http://www.domain.com/browse/by-category/electronics/1,2,3 etc

routes.MapPageRoute(
"ProductsBrowse",
"browse/{BrowseBy}/{Category}",
"~/Pages/Products/Browse.aspx"

View 1 Replies

Handle Optional Parameters In URL Routing?

Jun 2, 2010

I've already implemented URL routing in my app but there are cases where I may or may not get a paramter. In particular, I'm trying to come up with a good way to handle multi-language support. For example, if my regular URL is /SomeCategory/Friendly-Topic-URL, I want to have an optional language selector at the end but I'd like to be optional. So, if I get /SomeCategory/Friendly-Topic-URL/es, that should bring up the topic in Spanish but if get nothing, that should bring up English.

View 6 Replies

MVC Routing - Multiple (Optional) Search Parameters

Nov 26, 2010

I'm trying to implement a search function on an incident logging page that is working fine. Currently I am only able to search against one criteria at a time, using the following route:

View 2 Replies

.NET MVC Controller Parameter Optional?

Oct 5, 2010

I have the following scenario: my website displays articles (inputted by an admin. like a blog).So to view an article, the user is referred to Home/Articles/{article ID}.However, the user selects which article to view from within the Articles.aspx view itself, using a jsTree list.So I what I need to do is to be able to differentiate between two cases: the user is accessing a specific article, or he is simply trying to access the "main" articles page. I tried setting the "Articles" controller parameter as optional (int? id), but then I am having problems "using" the id value inside the controller.

View 7 Replies

VS 2008 - How To Declare Optional Parameter In C#

Jul 24, 2010

I want to declare Optional Parameter in C#.As in VB.Net we have OPTIONAL Keyword,In C# is there any way or we have to pass all the arguments in C#?

VB.NET CODE

[code]....

View 8 Replies

SQL Server :: How To Set A Optional Parameter To NULL

Oct 29, 2010

I have got a problem about setting the optional parameter to NULL in sql sp. Initially I set all the parameters null in the sql sp. That's OK. But I would like to set the parameters to Null again if a particular parameter has a value of - 1 by using the "IF ELSE" statement block. However, the problem was that I was unable to set the parameter to NULL in the IF ELSE statement. So please correct my IF ELSE statement in the store procedure. This is really urgent and important for my project.

spGetMealsByNutritions]
@MealTypeID Int,
@Gluten Bit = Null,
@Dairy Bit = Null,
@Egg Bit = Null,
@Fish Bit = Null,
@Veg Bit = Null,
@Pork Bit = Null,
@Beef Bit = Null,
@Soy Bit = Null,
@Sesame Bit = Null
[code]...

View 7 Replies

Optional Parameter Addition To A Colletion

Aug 16, 2010

am to add optional parameter to pass these in a method the parameter may vary every time.And i need to pass these parameter to a method, so my question is how should i add these optional parameter to a collection and what kind of collection object should i use and how should i use that.

View 1 Replies

DataSource Controls :: How To Pass Optional Parameter

Apr 22, 2010

I am getting return some data through stored procedure in a asp.net 3.5. Below is the method.

public DataSet GetDataSet(string strConnection,string strSPName, string param1)
{
DataSet ds = dataAccessLayer.getDataSet(strConnection, strSPName);
return ds;
}

In some cases, I have to pass 3-4 parameter. How can we do pass optional parameter here....

View 3 Replies

ASMX :: Optional Parameter Is Not Working At WCF Service

Jul 27, 2010

I was expecting a parameter will become a empty string value if the parameter is missing, but it turn out to be null. have I done it wrong for the optional parameter?

[Code]....

View 3 Replies

MVC Routes Adding An Optional Parameter At The Beginning Of A Route

Aug 7, 2010

I have the following routes setup in my route config file. I have a config reader that maps these to MVC-style routes.

[route name="customers" url="customers/{statename}/{marketname}/{pagenumber}"]
[controller name="Customers" action="Display" //route]
[route name="pcustomers" url="{customername}/customers/{statename}/{marketname}/{pagenumber}"]
[code]...

View 2 Replies

SQL Server :: Make 'providing Data To Parameter In Sproc Optional'?

Feb 3, 2011

i have a stored procedure with multiple parameters. and several statement which utilities a specific set of queries. therefore, every time its not necessary data will be passed through the parameters, so how can i make "providing data to parameter" optional

My stored procedure:

[Code]....

View 2 Replies

SQL Reporting :: Create A Multiple Optional Parameter In Report Builder?

Feb 24, 2011

I'm creating a reports with the following filter criteria:

ID - textbox Created Date - range between start and end date Syste Name - dropdown Users may filter the report based on the ID or System Name or all the criteria mentioned.

The search Field for ID, by default has a Null checkbox beside on it while other filter doesn't. how can I enable the checkbox for the other filters?

So I came across this article which should my issue. Apparently, I'm receiving a formula error "The arguments to the following functions are not valid:FIND" with this formula OR(FIND(Creation Date, Parameter: Creation Date)<>0, Parameter : Creation Date = Empty). see this link for the screenshot. I don't know what I'm missing. I'm using Reporting Services 2005

View 2 Replies

State Management :: Maintain Query String Parameter In All Pages - It Gets Lost In Subsequent Pages

Aug 9, 2010

In my Application_BeginRequest I have code that gets query string value ?c=FR or ?c=US and store it in cookies.Based on query string value I have either US or FR,locale is selected from locale table.If ?c=FR then locale will be fr-FR and if it is US then locale will be en-US.My code is below.

void Application_BeginRequest(object sender, EventArgs e)
{
LocalizationInfo loc = GetLocalizationInfo();
if (Request.Cookies["Localization"] == null)
Response.Cookies.Add(new HttpCookie("Localization"));
Response.Cookies["Localization"]["Country"] = loc.Country;
CultureInfo objCI = new CultureInfo(loc.Locale);
Thread.CurrentThread.CurrentCulture = objCI;
Thread.CurrentThread.CurrentUICulture = objCI;
}
public static LocalizationInfo GetLocalizationInfo()
{
string countryCode = "";
string sLocale = "";
if (HttpContext.Current.Response.Cookies["Localization"]["Country"] != null)
countryCode = HttpContext.Current.Response.Cookies["Localization"]["Country"];
if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["c"]))
countryCode = HttpContext.Current.Request.QueryString["c"];
if (countryCode == "")
countryCode = "US";
sLocale = HertzRent2Buy.DataProvider.ListData.GetLocale(countryCode);
LocalizationInfo ret = new LocalizationInfo();
ret.Country = countryCode;
ret.Locale = sLocale;
return ret;
}
public struct LocalizationInfo
{
public string Country;
public string Locale;
}

Now when I run the project and in query string I set [URL] then for the very first page(home page itself) it shows me French translation,but on subsequent page,that query string parameter ?c=FR is lost and hence it shows be English translation not French translation since it does not pickup French resx file.If I manually append ?c=FR in subsequent page then it shows the French translation.Is there is way how I can make that query stringparameter available in all pages.Structure is there to hold Country and locale variables. In all pages I am calling GetLocalizationInfo() method as follow

LocalizationInfo info = some.DataProvider.Globalization.GetLocalizationInfo();

And I create instance info to pass locale and country as parameter. GetProductDetails(id,info.Country,info.locale). why my query string parameters get lost on subsequent pages.

View 1 Replies

Mvc Routing Id Parameter

Apr 30, 2010

I am working on a website in asp.net mvc. I have a route

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
ew { controller = "Home", action = "Index", id = UrlParameter.Optional }

View 4 Replies

Global Routing Parameter In .net MVC

Sep 17, 2010

When a user clicks on a link, I want to log some information. I can't do an AJAX request because if they clicked on a link, the page will unload (since they're going to a new page), and I don't want to force them to stay on the page until a synchronous event finishes. So one idea I had was to add a parameter to the url. I.e. the urls would be actual/action?actualParams&infoIWantToLog=data. Then I could strip off the info I want to log, log that, and then pass off their URL to the action which they actually wanted to go to. Is this possible to do with MVC routing?

View 1 Replies

Routing Hide Id Parameter?

Jan 12, 2011

I am learning .net and building a site that uses url routing. I have it working although when attempting to get data from a database i am having to pass a ID parameter such as:

services/{id}/{category}/{subcategory}
portfolio/{id}/{category}/{title}
blog/{date}/{id}/{title}

I have seen websites that do the same thing but they don't appear to be passing an ID parameter, how do they acheive this?

if they wanted the information on a particular service as per the link above would you just run an SQL query looking for a match on the subcategory name or for a blog post you look for a match on the blog title and date?

It just seems a bit strange to me and if you have people adding blog posts etc there is always the slim possibility of more than one match.

View 4 Replies

MVC MapRoute Not Routing With Required Parameter

Jan 26, 2011

I'm wanting the URL to my MVC application to be like:www.site.com/BobWhich would in turn 'redirect' to Home/Details/Bob.I've set up the following MapRoute:routes.MapRoute( _Nothing, _"{personName}", _New With {.controller = "Home", .action = "Details", .personName = ""}, _
New With {.result = New NameConstraint()} _

View 1 Replies

Web Forms :: Passing Parameter While Routing?

Feb 12, 2011

i am doign url routing and it is working fine with url like followwing:-when ever i click on HOME/SEARCH i get redirected to ~/SEARCH1.aspx page.

[Code]....

BUT IF I REPLACE THE ABOVE URL WITH "~/SEARCH1.ASPX?ID=2"I GOT FOLLOWING ERROR:'~/search1.aspx?id=2' is not a valid virtual path. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Web.HttpException: '~/search1.aspx?id=2' is not a valid virtual path.i have to pass id to the search1.aspx page.what is the way out.

View 5 Replies

Web Forms :: Hiding Parameter Values In Routing?

Jul 24, 2010

This question is related to the asp.nt 4.0 routingI have a URL http://www.asp.net?CountryID=65&CountryName=Singaporeafter implementing routing i will get the URL as http://www.asp.net/65/Singapore/is there any way i can use the URL as http://www.asp.net/Singapore/its possible after removing the parameter CountryID, but the problem am facing here is, I also want to access the value 65 in the redirected page.

View 5 Replies

AJAX :: Slider Image Not Displaying When Using WebForms Routing

May 18, 2010

I've implemented WebForms Routing (using ASP.NET 3.5 SP1) and have a routed page that uses the AJAX Control Toolkit Slider control. The handle image doesn't always display, depending on the depth of the URL. I believe it may be something to do with the image being and embedded resource accessed via webresource.axd.

For example:

www.myapp.com/tours - will display the handle image
www.myapp.com/tours/london - doesn't display it.

My routing is configured as such:

[Code]....

On viewing the HTML source the actual image is rendered as:

[Code]....

Been hitting my head against a brick wall with this for days?

View 4 Replies

Web Forms :: MSCaptcha Not Working (Image Not Displaying) With URL Routing

Oct 21, 2015

Using the below mention link, I am getting the captcha image with no issues in simple application but when implemented in a URL routing page, images are not displaying.

[URL]

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved