Wednesday, 15 April 2015

c# - Is it possible to have a single URL that points to two different pages? -



c# - Is it possible to have a single URL that points to two different pages? -

i have 1 url (/settings) needs point 2 different pages depending on users security on login. 1 page existing webforms page other new mvc page. possible?

additional info: when user on either page url needs website.com/settings

solution: convinced pm alter requirements.

the short answer, yes. can several ways.

javascript model view controller (controller) asp.net web-forms (method)

it poor practice such event, can expose data. indeed possible:

javascript:

$(document).ready(function () { if($("#account").val() != '') { $(".url").attr('href', 'http://www.google.com'); } });

pretend #account hidden field populated database. if field is not null modify .url element navigate link. approach web-forms simple.

web-forms:

protected void btnaccount_click(object sender, eventargs e) { if(user.isinrole("account")) response.redirect("~/admin.aspx"); else response.redirect("~/user.aspx"); }

that utilize default windows authentication domain, bend , contort utilize database pull data. example, model view controller similar controller handle capability.

hope points in right direction.

c# model-view-controller

No comments:

Post a Comment