Web Forms :: Pass Custom Data Through URL Routing?

May 29, 2012

I use url routing according to this article [URL]

this is global.asax code

void Application_Start(object sender, EventArgs e) {
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes) {
routes.Add("BikeSaleRoute", new Route (
"bikes/sale",
new CustomRouteHandler("~/Details.aspx")
));


here when we type eg:[URL]  it go to details.aspx  now i want instead of bikes/sale that define here it read Behcode column from DB and when my user type their becode like this   [URL]  it go to details.aspx 

how i can do it?

this is my users table

Id Behcode name description

1 1111 Jack Test
2 2222 Sara test

View 1 Replies


Similar Messages:

Web Forms :: Pass Code Through URL Routing

Jun 3, 2012

I have 1 textbox 1 button in my page and user's table in database in this table is BEHCODE column that when users enter their behcode in TB they go to their page  i use query string for it on button click event

protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
{
string data = Server.UrlEncode(txtNumeric.Text);
SqlCommand _cmd = new SqlCommand("traidname", _cn);
_cmd.CommandType = CommandType.StoredProcedure;

[code]...

when i use querystring when users click on button and go to their page they see in address bar this address behtob.com/store?BehCode=1111 and if i use session when they click on button and go to their page they see this address in address bar behtob.com/store.aspx..

Now i want when user's enter their behcode in TB and click on button when they go to their page they see this address in address bar behtob.com/1111 1111 is user's behcode in DB is there any way to do it?

View 1 Replies

Web Forms :: Pass Multiple Parameters In URL Routing

May 7, 2015

I have seen demo on remove .aspx extension from url in asp.net, its a great articale, but i have few queries which i would like to ask.

How we can use same approcah when we are passing multiple values in a query string like:

"www.localhost/Category.aspx?Id=1&Name=abc"

In example shown that we need to write below code in global file like :

 routes.MapPageRoute("CustomerDetails", "Customers/{CustomerId}", "~/CustomerDetails.aspx");

but what about in above case?

View 1 Replies

Web Forms :: URL Routing - Pass ID To Next Page Via QueryString

May 27, 2012

I did it and it worked but when i wrote these code in addressbar i see this address

http://localhost:1420/behtop%20website/Store.aspx

I want this

E.g.:

When user type  behcode =1111 in TEXTBOX when click on button it go to store.aspx but i want in addressbar see this address

http://localhost:1420/behtop%20website/1111

instead of store.aspx  write 1111

How I can do it?

View 1 Replies

MVC Custom Routing Long Custom Route Not Clicking In Head?

Jun 5, 2010

I have spent several hours today reading up on doing Custom Routing in ASP.NET MVC. I can understand how to do any type of custom route if it expands from or is similar/smaller than the Default Route. However, I am trying figure out how to do a route similar to:

/Language/{LanguageID}/Question/{QuestionID}/

And what I would like, too, is similar to how SO works. Something like:

/Language/{LanguageID}/Arabic/Question/{QuestionID}/Some-Question-Title

Where "Arabic" and "Some-Question-Title" can be almost anything because what really matters is the ID's

A complete url example might be

[URL]

Am I going beyond what can be done with the extended URL past the language ID?

View 1 Replies

C# - Pass URL In Custom Action Data

Mar 1, 2010

I have created a VS 2008 web setup project with a dialog so that I can modify the web.config file at install. The setup worked as expected. However, I can not seem to accept a URL for a property value via custom data. I know directories are escaped with "", is there any similar escaping or tricks for a URL.

View 1 Replies

C# - How To Pass Data To A Custom Error Page

May 24, 2010

How can I pass some data from a Global.asax event handler to a custom error page in ASP.NET without using Server.Transfer or some redirect?

View 1 Replies

Custom Server Controls :: Pass Javacript To Custom Control With ClientID?

Sep 17, 2010

I have a custom control that I have created. I want to be able to pass in a Javascript snippet for a callback function. I am able to do this by passing a string back. The problem is that in the Javascript, I need to reference another server control that is not related to my custom control. So, I need to be able to pass in the ClientID of that control for use in the Javascript. Here is a snippet of what I am trying to do:

[Code]....

Now, I realize that '<%= chkStartDate.ClientID %>' will not be parsed. But, I need it to be parsed so the OnClientOnChangeEvent property of my custom control can take any Javascript for use as a callback. In this instance, I need to pass in the ClientID of the control for the Javascript function to find the control to work with; and this seems to be the one issue that I don't know how to handle.

View 2 Replies

MVC :: Synonyms For Controllers (Custom Routing)?

Jul 18, 2010

I have an ASP.NET 4 MVC2 multi-language application and I need the same HomeController to response ДОМОЙ as well.Our application has 12 Controllers and should support 9 different languages.The optimal solution would be to override some FindControllerByName & FindViewByName, but I can't find such functions.
Do any of you guys know how can I achieve such a behavior?

View 4 Replies

Custom Server Controls :: Can't Pass Data From Usercontrol To Page

Jan 25, 2011

I tried both, loading the usercontrol when needed and I also tried adding it directly into the aspx.

Nothing worked. With the second one (what's meant to be the easiest option) I tried with delegates and events (but can't access de usercontrol event from page) and tried with properties (I can access properties but they're always empty)

View 12 Replies

Configuration :: Web Form Routing And 404 Custom Error Page?

Jan 28, 2011

I have a problem with my site, and I'm using .net 4, web form routing

I have this route ,routes.MapPageRoute("JobPreview", "jobs/{jobId}/{pg}/{Position}", "~/default.aspx")

so, this page is working fine
http://www.jobsagents.com/jobs/24651/1/automation-qa-engineer

If we remove the last segment of this url, it should be redirected to the custom 404 not found page, but in the deployment server it redirects to the default IIS error page for 404 errors

http://www.jobsagents.com/jobs/24651/1/, on my local machine it's ok, and shows my custom error page.

If we remove the last three segments of the url
http://www.jobsagents.com/jobs it works fine on the deployment server.

View 1 Replies

How To Implement Custom 404 Page In .NET Web Form Application Using Routing

Jun 19, 2010

I am using ASP.NET 4.0 Web Forms. I learned that, in order to optimize my Web Application for Search Engine, I must implement custom 404 page. But the way Microsoft tell us to implement custom 404 (within Web.Config file), that is not good for SEO. Microsoft says,

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="404" redirect="Page-Not-Found.aspx" />
</customErrors>

But when the page is not found, IIS issue 302 redirect to Page-Not-Found.aspx page which is not good. So, I implemented custom 404 page using Routing technique that is available in ASP.NET 3.5 SP1 and 4.0. I used the following router in Global.asax page

View 2 Replies

.NET MVC2 Custom Routing With Wildcard Or Free Text Url?

Sep 28, 2010

I have a requirement to add specific functionality to an asp.net mvc2 web site to provide addtional SEO capability, as follows:

The incoming URL is plain text, perhaps a containing a sentence as follows

"http://somesite.com/welcome-to-our-web-site" or "http://somesite.com/cool things/check-out-this-awesome-video"

In the MVC pipeline, I would like to take this URL, strip off the website name, look up the remaining portion in a database table and call an appropriate controller/view based on the content of the data in the table. All controllers will simply take a single parameter bieng the unique id from the lookup table. A different controller may be used depnding on different urls, but this must be derieved from the database.

If the url cannot be resolved a 404 error needs to be provided, if the url is found but obsolete then a 302 redirect needs to be provided.Where the url is resolved it must be retained in the browser address bar.

I have had a look at the routing model, and custom routing and can't quite work out how to do it using these, as the controller would not be predefined, based on a simple route. I am also unsure of what to do to provide 404, 302 back to the headers also.Perhpas I need a custom httpmodule or similar but going there went beyond my understanding.

View 5 Replies

Web Forms :: Web.Routing Doesn't Work On Server On IIS Routing

Jul 20, 2010

I tried everything I could find, but still does not work on IIS routing.

View 2 Replies

Routing With Web Forms - Could Not Load System.Web.Routing

Dec 12, 2010

I am using:

ASP.NET 3.5 SP1 with Web Forms Routing thru Global.asax (System.Web.Routing and RegisterRoutes)IIS 7

Everything is working fine in my local machine, but it gives the following error in my hosting environment:

Could not load file or assembly 'System.Web.Routing, Version=3.5.0.0, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I did everything inside my web.config file mentioned in the following link:

[URL]

But I am still getting the above error.

What else am I supposed to do fix the error?

View 1 Replies

Web Forms :: How To Pass Exception Message To Custom Error Page

Apr 12, 2010

I am trying to passing Exception info tpa custom error page that I have created, and I'm looking for the best way to do so.I ended up creating a session object on my Global.asax page, and I pass the error data to the session object during the Application_Error event, but it throws it's own exception prior to working.

[Code]....

I have also updated my web.config with my error page that I would like to pass session object data to:

[Code]....

View 2 Replies

Rest WCF Url Routing & Web Forms Routing?

Feb 22, 2011

I have a Web application where i have added a reference to a RESTful WCF. I got the WCF url Routing to work in my webapplication by adding Inherits="RestService.Global" to the Web applications Global.asax.

<%@ Application Codebehind="Global.asax.cs" Inherits="RestService.Global" Language="C#" %>

But then i tried to create url Routing for the Web application and it does not work with the Inherits="RestService.Global" in the Global.asax. If i take it away it works fine. Is there a correct way to do this.

View 1 Replies

Web Forms :: URL Routing And Dynamic Routing?

Jan 31, 2011

I'm trying to create my own CMS and I've gotten a little bit stuck at the stage of URL routing.

I want clean URLs without extensions and I'd like to be able to create and modify them in a web based interface without any messing around with IIS or actual files.

I've seen how to create a static route, but for that I need to go into my Global.asax file and manually add it.I would like to have all of these routes stored in a database so that I can easily modify them later.

Does anyone know how this can be achieved?

Just for extra information, I will be attempting to create a feature so that if a path exists, but is later changed, a 301 redirect is created to the new URL, is this also possible? (My first problem is the main issue, but thought I might ask this as well just in case it makes a difference)

View 2 Replies

Web Forms :: Allow Only Valid Data In URL Routing

May 31, 2012

I use url routing according to this article [URL] .....

In global.asax i use this code

public static void RegisterRoutes(RouteCollection routes) {
        routes.Add("BikeSaleRoute", new Route  (
           "{Data}/",
           new CustomRouteHandler("~/Details.aspx")
        ));
    }

Here when I write behtob.com/1111 or behtob.com/test it go to details.aspx page i want instead of {Data} it read behtop column from my DB  and according to that behcode it go to details.aspx and fill that page with user's  information that have behcode in address bar i want bind it from data base

Id Behcode Name Description image
1 2222 Iron Test 1.jpg
4 3333 Laundry Test 2.jpg

I want some thin like facebook.

View 1 Replies

Custom Server Controls :: Pass A Variable Through A Parameter?

Jan 26, 2010

This may be elementary user control stuff, but I can't get it to work.

How can I pass the Membership.GetUser.UserName variable (or any variable) through a user control parameter at load time?

[Code]....

The only thing that I was able to do was to create the User Control object in the code behind and then add it to the page. Although that works, it doesn't seem like the correct way to program.

View 1 Replies

MVC :: Custom ControllerFactory Parameter ControllerName Pass Incorrect Name?

Jun 14, 2010

My custome ControllerFactory controllerName is passed an Action name and not the only Controller in my application. Where or how can I correct this so my Controller name, SearchMembers, is passed in and not the Action name of that method, Search.

[code]....

View 1 Replies

HttpHandlers / Modules :: How To Pass Custom Information To Our HTTPHandler

Mar 8, 2011

We have a handler to deal with .dat files.. everything is already setup and server is acknowledging the file type and doing its thing to handle it..

But the handler requires 1 bit of information along with the HTTP request which is a physical file path.. the file name it knows based on the file we call , but how can i pass a custom header along with the request so that the handler will use that when the request is made?

Basically when on our player.aspx page, i will have a button, when you click that button a request is made to the .dat file, but along with that request i need to send the physical file path.. how can i do that?

View 3 Replies

Security :: Use Custom Key Instead Of Default Key / Pass Public And Private Key At RSACryptoProvider

Apr 24, 2010

I am working with RSA Algorithm recently.

I want to use RSACryptoProvider for this purpose.

But i want to use my custom Key instead of default key

for example my public Key =(187, 7)

and my private key=(187,23)

how can i pass my public and private key at RSACryptoProvider

View 2 Replies

Custom Class To Store The Properties And To Pass Its Instance Across The Pages

May 12, 2010

I've a requirement where i need to pass some objects across the pages. So i created a custom class with all the properties required and created a instance of it and assigned all the properties appropriately. I then put that object in the session and took it the other page. The problem is that even when i set the properties values to the class it is coming as null. I set a breakpoint in the getter-setter and saw that the value itself is coming as null.

public class GetDataSetForReports
{
private Table m_aspTable;
private int m_reportID;
private string m_accountKey;
private string m_siteKey;
private string m_imUserName;
/// <summary>
/// Asp Table containing the filters
/// </summary>
public Table aspTable
{
get
{
return m_aspTable;
}
set
{
m_aspTable = aspTable;
}
}
/// <summary>
/// Report ID
/// </summary>
public int reportID
{
get
{
return m_reportID;
}
set
{
m_reportID = reportID;
}
}
/// <summary>
/// All the accounts selected
/// </summary>
public string accountKey
{
get
{
return m_accountKey;
}
set
{
m_accountKey = accountKey;
}
}
/// <summary>
/// All the sites selected
/// </summary>
public string siteKey
{
get
{
return m_siteKey;
}
set
{
m_siteKey = siteKey;
}
}
/// <summary>
/// Current User Name
/// </summary>
public string imUserName
{
get
{
return m_imUserName;
}
set
{
m_imUserName = imUserName;
}
}
}

This is how i'm creating an instance in the page1 and trying to get it in the page2. Page1 Code

//Add the objects to the GetDataSetForReports Class
GetDataSetForReports oGetDSForReports = new GetDataSetForReports();
oGetDSForReports.aspTable = aspTable;
oGetDSForReports.reportID = iReportID;
oGetDSForReports.accountKey = AccountKey;
oGetDSForReports.siteKey = Sitekey;
oGetDSForReports.imUserName = this.imUserName.ToString();

But the values are not getting set at all. The values are not passing to the class (to the setter) at all. Am i making any OOP blunder?

View 1 Replies

C# - Custom MembershipProvider Attempts To Pass Empty Creds After IIS Restart

Mar 12, 2010

I have a C# custom ASP.Net MembershipProvider. When the user attempts to navigate to another part of the site after IIS is restarted, it doesn't navigate to the login page to collect credentials, but instead attempts to authenticate with empty credentials.

what I have to do to identify that the new authentication needs to take place and that new creds need to be gathered?

I have a complementary custom IHttpModule implementation that allows me to intercept events like BeginRequest and AuthenticateRequest, if that helps.

View 1 Replies







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