Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Response.Redirect
Message
 
 
À
13/07/2016 02:52:37
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01638287
Message ID:
01638315
Vues:
37
>>Hi everybody,
>>
>>I have HomeController.cs with this method:
>>
>>
>>public ActionResult Index()
>>        {
>>            var retVal = _licenseProvider.ValidateExistingLicense();
>>
>>            if (!retVal.Item1)
>>            {
>>                Response.Redirect("DataMaintenance/ImportLicenses", true);
>>            }
>>
>>Then the logic continues and finally it returns a View() (index).
>
>>
>>I'm wondering if it's possible to somehow return after re-direct? Perhaps use that view (ImportLicenses) instead of the index?
>>
>>If yes, how should I adjust that method?
>>
>>Thanks in advance.
>>
>>To expand on my question, as I already solved this first problem.
>>
>>I want to know from the ImportLicenses controller if I was re-directed there or came from the normal menu choice. How can I somehow pass information that I'm re-directing?
>
>I thought that if the second Response.Redirect() parameter is 'true' then the logic *doesn't* continue (i.e. any code following the redirect is not executed) ?

When I was debugging, I saw the rest of the code in the method continue to execute. I had a bit more discussion on that problem in this thread and although I solved my immediate problem by a bit of cheating, I'm thinking of trying to use RedirectToAction method instead.

http://stackoverflow.com/questions/38341415/detecting-redirect-to-a-different-url

My other problem is that right now (and all of this code was not designed by me originally but by contractors who no longer work on the project) is that the logic goes like this:

The application starts, HomeController code kicks in. It finds absence of the license, it opens a new form to import the license. That dialog is currently using a simple modal dialog (the reason for detection re-direct was to hide Cancel and close buttons on that dialog when comes from redirect). The problem with Modal is that you can simply press escape or click outside the form, the form disappears and you now can proceed normally with the application.

Do you know if there is a way to not allow modal dialog to close that way (using uibModal service from angular)?

UPDATE. I found an answer to this question here

http://stackoverflow.com/questions/20286445/how-do-i-prevent-angular-ui-modal-from-closing

The answer worked for me.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform