I'm building a system which can create forms during runtime. System is written for WinForms and works well for creation of Windows forms and reports. Forms are written to the database as XML.
Now I want to extend that principle to web domain. On Default.aspx for example I plan to put placeholder and write code for creation of web controls.
The question that bugs me is - how can I open such web page from my WinForms appliaction? I need to open it in default browser and transmit ID to it.
The sequence is this - Design the form, save it to database, open a web page with form rendered on it.
Ok so taking the trival example of saving a form to the DB it will get an ID.
You can then have an ASP.Net page that expects to be passed a param on the QS of formid=1
so
http://yoursite/formbuilder.aspx?formid=1
Within your page you can then check if that id is passed in on the querystring and create the form that way.
To open the browser you can do something similar to this
System.Diagnostics.Process.Start("http://<yoursite>/formbuilder.aspx?formid=1");
Related
I'm working on a project to upgrade a Classic ASP implementation of ActiveLINC into .Net using the Component Enabler from Unisys, but am having problems when switching between mainframe databases.
The ASP.Net Web Controls (that are created as a result of the Component Enabler running) are easily dropped into ASP.Net and work as expected. But when I try to 'Bye' out of a screen and return to the login page to then connect into a different mainframe database, the first database is still used in the connection process and is where I subsequently get logged into.
This behaviour isn't present in the Classic ASP version of the ActiveLINC site, and I can't imagine that I wouldn't be able to switch databases like this... am I doing something wrong here!?
If you're using the standard Component Enabler output, each mainframe database is meant to be hosted as an individual website in IIS.
I've created a 'wrapper' website, that in it's basic form, contains a list of links to each individual 'mainframe' website, which allows me to achieve the sort of database switching I think you want. To make this work, I had to make changes to the generic Login.aspx page to accept username/password form values from my 'wrapper' site and then to use these as part of the login process. I also changed the generic Default.aspx to redirect any timeouts, logouts, etc. to my 'wrapper' site, but this will vary depending on your requirements.
I'm trying to use SSRS reporting with an Asp.net MVC website with local reports.
I tried everything that is mentioned in this post, but I keep getting a hidden div with the following message instead:
The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add to the system.web/httpHandlers section of the web.config file, or add to the system.webServer/handlers section for Internet Information Services 7 or later.
The handlers are correctly added to the web config and reports will work if I navigate to the aspx page directly (by , but since view engine is not involved I cannot use any of razor helpers, this problem only occurs when I'm using routing.
I have RouteExistingFiles = false and ignored the following routes:
{resource}.axd/{*pathInfo};
{resource}.aspx/{*pathInfo};
{resource}.ascx/{*pathInfo};
and disabled the BlockViewHandler by removing it from the webconfig.
I'm using Microsoft.ReportViewer for visual studio 2012 (ver 11.0.0.0)
Edit
There is this post from Scot Hanselman about using razor views with ASPX master pages, I'm doing the exact reverse, using aspx user control with Razor layout, but this Microsoft report viewer does not work with this approach.
Because of your comments, I've found the reason because it's not working.
I have a User control that uses the report viewer, and a aspx page that uses that user control to show the reports. if I navigate directly to the report like: myhost/Views/Shared/ReportViewer.aspx it works, if I use routing like: myhost/report/myreport it wont work
When you navigate directly to the page, it's rendered by the "traditional" web forms infrasctructure, so all the elements needed by the report viewer (view state, script manager and son on) are available, and the report viewer works fine.
When you navigate using routing, form the comments:
yes creating a route that makes the reportviewer to be handled by an MVC controller which returns a razor view that renders report user control using Html.RenderPartial("ReportControl")
In this case, you're rendering a traditional web form as if it was a razor page. When you do this, all the infrastructure needed by the report viewer control is missing (particularly the view state), and thus it doesn't work.
So, you need to show the report viewer page as a traditional web form. You can open it in a new window/tab by using javascript. If you still want to integrate it in an existing MVC page, the only solution is to use an <iframe> and render the report inside it.
Another solution to integrate it directly in an MVC page would be to render the report using the Reporting Services web service, and sending the output to the browser (for example as a .jpg image or a PDF doc). But, whichever format you choose, it will lack the report viewer interactitvity.
I have this situation in my SL4 application: We create some User Accounts in the Silverlight APP, now we want to generate printable reports for the generated accounts which we will hand out to the users. The idea is to save the information from the created account to a database, redirect from the Silverlight App to an ASP.NET page passing the ID of the stored account information and display the data in a report viewer control in asp.net from where it can be printed and exported.
Is this possible or am I completely wrong? How can I redirect from silverlight to the asp.net page and how can I pass the ID?
You can use Window.Navigate to do the same. For example,
// Navigate to the web page
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(”http://www.xyz.com/report.aspx”));
//Open in a separate window
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(”http://www.xyz.com/report.aspx”), “_blank”);
You can pass the id using the query-string.
See this SO question that discusses other options: redirect to another page from Silverlight
I have a different way of showing reports in a Silverlight application. I make use of the Acrobat Reader plugin to do the displaying for me. It does require a different method depending on whether your application is running inside or outside the browser (I check if the application is running inside the browser and change the means of display accordingly). If running inside the browser, I overlay the application with an IFrame, as I describe in this article: http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-6.aspx. Otherwise, I use the WebBrowser control. I have a control which does this all for you in the source code that accompanies my book, which is downloadable from the Apress website here: http://www.apress.com/9781430272076/.
NOTE: I copied this answer from my previous response to a similar question here: Show pdf inside silverlight application. PDF to XAML
I have decided to use ASP.NET MVC to develop multi page (registration) forms in asp.net. There will be two buttons on each page that allows the user to navigate to the previous and next page. When the user navigates back to a page they recently filled out, the data should be displayed to them. I understand ASP.NET MVC should remain stateless but how should I maintain page information when the user navigates back and forth.
Should I?
Save the information to a database and retrieve information for each page change?
save information to the session?
Load all the fields and display only whats's needed with javascript?
This registration form is going to be used in multiple sites but with different sets of questions (Some may be the same). IF performance is a main concern, should I avoid generating these forms dynamically?
Jay
This sounds like the kind of information that you would want to store in a user session. What session store is used can be configured, so you could use a database to store session for users if that would be a better fit than using in-process session.
We have an old web app written in classic ASP. We don't have the resources to rewrite the app.
I know that asp and aspx pages can coexist in the same ASP.NET web app, but it appears as those you cannot share Application and probably Session variables across these two groups of page extension types.
I was hoping to do new development in ASP.NET and to in theory, convert the Classic ASP pages over as we go.
Is there a way to share IIS variables across these two types of web pages (aside from passing information using the query string and forms fields)?
There is no straigthforwad solution for sharing session variables between classic ASP and ASP.NET. I would recommend you to persist sessions into a database, like it is described in this Microsoft Article. This way both ASP and ASP.NET can access session variables.
Not a direct way. You could consider using a shared database backend for your session state.
You could create a simple table in your DB to store the "session" info in. Both the classic asp and the .net pages could read and write there.
The only ways to pass this data would be GET/POST values, cookies, flat file, or storing the data to the database. There is nothing "Built In" to the .Net framework to do this.
I have seen another solution aside from using the database as shared session holder. I should say beforehand that using the database option is probably much better than this. But...
You can create an ASP page whose only function is to store into and retrieve from the ASP session state. From your ASPX page you can make a webrequest to your ASP page and return any session information in the header, querystring, or even do a scrape of the restulant load. Alternatively you can return an XML stream and make a poor man's web service.
I addition, you could get session state from ASP.NET by doing the opposite and making a .NET page that access session info and returns it.
It's not a good idea and fraught with security problems. I have seen it done is all I'm saying. It's really probably best to rely on the database and possibly pass session ID around.
Well I just have faced this problem, and want to tell you that just were able to solve it in one way. The solution was relatively easy and actually depends on your original development, in my case the system flow requires to log-in in a default.aspx page and after validating the user/password are correct the page Init.asp is executed and exactly there many session vars are created and loaded (actually are just the minimum needed) after that the last instruction redirects the user to mainmenu.aspx and form that page we call .aspx and .asp files.
This solution worked for me just because of the election the original developer made when designed this ASP 3.0 application and as you can imagine I can't retrieve those values in the asp.net pages.
I just went through this. My solution was to wrap it all in a nodejs app. I dole out JWT tokens from .NET web API that have all the users claims encoded in the payload. This token gets stored in a cookie on the client. The cookie will automatically get submitted on each request to your domain so all you need to do is read the cookie value from the header and decode the payload (in ASP.NET and Classic ASP independently). Once you read the contents, you can simply set the session variables to match those that were embedded in the JWT token.
I prefer this method because it has 0 database synchronization necessary and moves your application to OAuth2 openid and away from session.