C# - How To Test Wildcard Domain Logic

Nov 28, 2010

Here is an interesting problem... I have configured wildcard domains on my production site and will be using it as a customer identifier. This allows me to display the right banner/css/logos for each customer simply be pulling out the wildcard prefix (eg. CompanyABC.website.com will be displayed the logos and branding related to CompanyABC).

But how do I test this on my local Visual Studio 2010 installation? In production the site loads COMPANY.website.com etc., but locally I can only use the flat http://localhost address.

View 3 Replies


Similar Messages:

C# - Sharing Domain Logic Between Similar Classes In Architecture?

Mar 24, 2011

My MVC ASP.NET web application is split up like this:

Web Application Layer Views

[Code]....

Now, I have a view in the database called "EquipmentWithCableDetails", which contains additional useful information with the equipment details - so I create a class to model that view (in order to be able to read from it). In the code I have that works with that new class, I want to display the EquipmentDescription - but that property only exists on the Equipment class.

View 2 Replies

Setting A Default Value -- Presentation Logic Or Business Logic?

Jun 18, 2010

I was wondering if setting a default value for a SelectList is considered to be presentation logic or business logic? For example, if a requirement is that an Employee cannot be saved without a Location, but 99% of the time the location that would be selected is a particular item -- say Atlanta. Because of this, the location SelectList should be defaulted to Atlanta when ever a entry screen for a new employee is displayed. Should I be defaulting the location in the model or in the view-model? One thing I realized is that the unit tests become awkward because in both cases, I'd be forced to test against a location that will always be present in production but I cannot create a unit test with my own test dataunless "Atlanta" was in the set of locations being used in the test.

View 4 Replies

C# - Is A New Thread In A Visual Studio Test Project Aborted When The Test Ends

May 15, 2010

i have to do some message exchange with a 3rd party (in a website).When the client posts a page, i start the message exchange. When that doesn't succeed for some reason, i report this to the client by rendering the page with a message.On the background, in a separate thread, i start a process to send abort messages to the 3rd party. I can't do this while the user is waiting for the page to come back, because it might take a few minutes.But in a test project, the test ends when the message to the 3rd party is sent, and after the new thread is started. But it seems that the new thread also ends, when the test is done.

Is that normal behaviour?I do start the thread in a new class with a reference to 2 objects from the class which tries to send the message in the first place, may that be a problem?EDIT: it keeps running when the whole process is started in IIS

View 1 Replies

Passing A Wildcard Value As An URL?

Jan 10, 2011

My students are working on an ASP.net VB application for a Web Programming competition and we are having problems with a page where we want an URL string to return all values from our database.

Here is the page:

[URL]

If you use the jobs by category menu on the left side, if you select a job category (ie retail) it will pull up all the jobs from that category. By using a query in the URL like this:

[URL]

What we need is the URL that would show all jobs regardless of the category. I'm not sure how to do this with asp.net VB. I'm sure it's probably not all that hard, we just don't know the syntax to make it happen.

View 24 Replies

IIS Setting For Wildcard Character?

Mar 10, 2011

Is there any setting changes in IIS to support wildcard character? I am running a web application but IIS does not support wildcard character.

View 1 Replies

.NET Webforms Wildcard Route?

Sep 29, 2010

I'm using asp.net routing in a webforms app.

I would like to achieve the following url format:

http://[domain]/{parent-category}/{sub-category}/{sub-category}

where the right most category is available as a route value.

Currently I have achieved this with the following route:

routes.MapPageRoute(
"category-browse",
"{*category}",
"~/category.aspx"
);

This will pass all of the categories i.e. "trainers/running/nike-running-trainers" so I can grab the last one with a bit of string manipulation.

Is there a better way of doing this?

View 1 Replies

Finding Wildcard String Replace?

Oct 21, 2010

I am using a chat script I found for free online.

It allows a profanity filter by using string replace:

ex: ChatText.Replace("hell", "!@#$")

is there a way to do a wildcard replace? It doesn't catch the word "HELL" or "Hell" for example.

View 2 Replies

Web Forms :: Wildcard Subdomain Using 4 Routing

Mar 18, 2011

I'm using ASP.NET 4 WebForms, and can't find information about creating wildcard subdomains.

For example, url user22.example.com must point to example.com/users/user22.

May i implement this feature only with Routing (without IIS url-rewrite, or another external tools)?

View 3 Replies

Routing (in Webforms) Without Wildcard Mapping?

Jul 19, 2010

If you cannot turn on wildcard mapping for IIS (shared hosting) or can't be bothered (lazyness) can you still use ASP.Net routing if your routes end in one of the "known" asp.net extensions...like ending all routes with .ashx, .aspx etc?

From Chris Cavenagh's blog, could his examples of:

[code]...

I'm presuming so as his last route is Default.aspx, but he hasn't included any route data with that...Is there a better way? Provided this works, it looks like the best as if the application is moved or wildcard mapping can be turned on, only the routes need to change...

View 1 Replies

Wildcard Mapping For Extensionless URLs?

Apr 5, 2010

I'm working in a shared hosting environment, so my access to IIS is limited, but I need to know if I even need full access to IIS to use extension-less URLs the way I'm using them.

Basically I'm just calling a RewritePath() in the Application_BeginRequestion() method in the Global.asax.cs file... something like this:

[code]...

will this require Wildcard Mapping in IIS?

View 1 Replies

ADO.NET :: Linq And Dynamic Where Clause With Wildcard?

Mar 25, 2011

Linq add wildcard in the where clause dynamically I have a query, i.e.

var query = from r in context.company .....

then have some business logic and based on the validation I want to add dynamically a where clause

if(a == "1")

query = query.Where(r=> r.Name = Fullname); //works!!

else if(a == "2)

query = query.Where SqlMethods.Like(r=> r.Name,"%"+Fullname+"%"); //fails to compile , the r.Name is not found..

View 3 Replies

EntityDataSource Replace * With % Wildcard On Queries?

Jan 8, 2011

I have an application that uses EntityDataSource in many places. In the EDS, I manually build the Where clause based on user input from TextBox'es.

I would like the user to be able to enter "*" (asterisks) instead of "%" when querying data.

Is there an easy as using Entity SQL or the EDS itself to do a search/replace? I know I could actually change the TextBox after the data is entered, but when the user sees his text was changed from an * to a % I don't think he will understand.

I have tried using the T-SQL Replace command and doing something like this:

<asp:EntityDataSource ID="EDSParts" runat="server"
ConnectionString="name=TTEntities" DefaultContainerName="TTEntities"
EnableFlattening="False" EntitySetName="Parts"[code]....

But I get a "Server tag is not well formed" message. I can't find an equivalent "replace" function in the Entity SQL reference....

View 2 Replies

C# - SQL To Select Rows That Match A URL With Wildcard?

Aug 4, 2010

I have a table in the db with one column containing a URL like http://site.com/users/*/profile.I am given a URL (like http://site.com/users/234/profile) and want to select all the rows in the db that match the url (in this case * is a wildcard).

I was thinking of using Regex to do this, by replacing the * with regex for any character. But am unsure as to what the SQL or LINQ code should be for the selection.

View 2 Replies

Wildcard HttpHandler Not Handling Static Files?

Jan 26, 2010

I had a look through some of the older questions, but I can't find anything.I have a Wildcard HttpHandler on my web app which is processing the url and working out if it can do anything with itIf it can't, then the StaticFile Handler should pick it up and just serve it as a static file (like an html file).The problem is, it's going through the Wildcard handler, then seemingly not going to the StaticFileHander. Is there something I need to do to the Wildcard handler, or in the web config?This is my web.config:

<add name="Wildcard" path="*" verb="*" type="Rewriter.RewriterHttpModule"
modules="IsapiModule" requireAccess="None" allowPathInfo="false"
preCondition="" responseBufferLimit="4194304" />
<add name="StaticFile" path="*.*" verb="*"
modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
scriptProcessor="%windir%Microsoft.NETFrameworkv2.0.50727aspnet_isapi.dll"
resourceType="File" requireAccess="Read" allowPathInfo="false" preCondition=""
responseBufferLimit="4194304" />

View 3 Replies

C# - Regular Expression To Match IP Address + Wildcard?

Jun 8, 2010

I'm trying to use a RegularexpressionValidator to match an IP address (with possible wildcards) for an IP filtering system.I'm using the following Regex:

"([0-9]{1,3}\.|\*\.){3}([0-9]{1,3}|\*){1}"

Which works fine when running it in LINQPad with Regex.Matches, but doesn't seem to work when I'm using the validator.Does anyone have a suggestion as to either a better Regex or why it would work in test but not in situ?

View 5 Replies

State Management :: How To Keep Current User Session When Redirected To Sub Domain From Main Domain

Feb 17, 2011

I have also installed SSL on a subdomain. I have put payment page under this sub domain.

View 4 Replies

Windows Authentication - Run Application Under Domain Account Without Joining The Domain?

Sep 28, 2010

My feeling says it's not posible but anyway I am curious if there is at least a workaround for accomplish this.Basically I am working at my client site and my machine is not connected to the domain.What I want to do is running a web application locally under a domain account, and using the webdev server.The webapp uses the default authentication, windows authentication that is.I tried using impersonation with domainuser & password but I got the following error Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user name or bad password.I have to mention that the username and the password are correct.

View 1 Replies

The Trust Relationship Between The Primary Domain And The Trusted Domain Failed

Aug 3, 2010

We have a ASP.NET site that partially depends on forms authentication for login credentials, however the implementation of IPrincipal is completely custom.

But, when running the site on a particular server (which is somewhat semi-hardened when it comes to security), the app crashes when invoking IPrincipal.IsInRole() with the following messsage:

System.SystemException: The trust relationship between the primary domain and the trusted domain failed.

This indicates a communication error between the web-server and the DC, however since our application doesn't at all utilizes Windows authentication, I don't see why it needs to communicate with the DC.

This is my implementation:

[code]...

EDIT:

I was finally enable to reproduce this error on my dev-machine (i revoked my machine from the DC yesterday, but didn't reproduce it until today)

HttpContext.User is actually a WindowsPrincipal by default it seems, and the error in my code was that I only replace it with CustomPrincipal upon login. Hence, unathenticated users still get the WindowsPrincipal which then fails horribly if you have trust issues on your AD.

I tried changing the default principal by invoking this on appstart

AppDomain.CurrentDomain.SetPrincipalPolicy( PrincipalPolicy.NoPrincipal);

But this doesn't seem to kick in. How do I change the default Principal in ASP.NET?

View 1 Replies

C# - Sharepoint Retrieving Username Without Domain Or Programmatically Removing Domain

Aug 16, 2010

Im returning the username from sharepoint site as a string. This is done successfully with the below code but I also get the domain with it. How can I only return the username and not the domain either through sharepoint or programmatically removing it? domain/username

[Code]....

View 3 Replies

C# - WCF Methods Return 404 When Wildcard Mapping Is Enabled In IIS6?

Nov 5, 2010

I have a REST WCF service defined as follows:

[ServiceContract]
public interface IRest {
[OperationContract]
[WebGet(UriTemplate = "/test")]
int Test();
}

With the following web.config:

[code]....

EDIT: You can all reproduce this by creating a new WCF Service in VS2008 (new Project > WCF Service Application). Browse to the dummy method ('GetData')... you will notice it returns 400... that's fine because it shows it's still forwarding to WCF. However, if you enable wildcard mapping in IIS6 you will now get a 404, meaning WCF is no longer intercepting the request.

View 2 Replies

DataSource Controls :: Rename Columns With Wildcard Select?

Apr 9, 2010

Is there a way to do a

"select * as"

and rename all columns with some prefix, rather than having to name columns individually? Or better yet, when doing a join and getting all columns from both tables, how do you identify them uniquely in the VB where some columns have the same name?

View 5 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

Security :: Impersonation With Domain Account Without Joining The Domain?

Sep 28, 2010

My feeling says it's not posible but anyway I am curious if there is at least a workaround for accomplish this.Basically I am working at my client site and my machine is not connected to the domain.What I want to do is running a web application locally under a domain account, and using the webdev server.The webapp uses the default authentication, windows authentication that is.I tried using impersonation with domainuser & password but I got the following error Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user name or bad password.I have to mention that the username and the password are correct.

View 2 Replies

How To Autheticate A Domain User From The Web Application Hosted On Another Domain

Jul 28, 2010

I have two domain servers X and Y.My Asp.net Web application is hosted on Domain X.But my scope is required to authorize the user of Domain Y on the Web application hosted on Domain X server.I am using Windows Authetication mode in application

View 2 Replies







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