How to create aspx pages into domain? - c#

I have users, they are signing in system. They have developed pages (using edit button and then press save button) but this is my CMS pages. I want to copy my single pages user by user to publish them. How to create dynamic aspx pages, with config files etc? How to add domain folder?

Generally there's no need to create aspx page or static html pages per user. What you need to do is store his/her post body and other necessary info in db and then create a main page to place user-specific data (like post body, posted-by,..) on it.
For example, you may have a route like this:
/post.aspx?userId=1
This page pulls data from database for the user of Id=1.

Related

Is there any way to store view state of a first page when user want to back from second one?

I have two pages.
On first user want to filter some data. After that he pick some value and go to second page.
On second page he will do some tasks and then he want to get back to first page to pick some other value to do other tasks.
But for now he have to filter back some data (on first page), but I want call back his filters. Is there any way to do this?
You got a few options here for this.
As STT mentioned in his comment to save the filter data in a session variable/ViewState, works all fine when you only got one web server otherwise you need to setup a shared sessions cache etc. The date will be kept temporary in the Server.
You can also save the data to a cookie and when loading page 1 reload last used filter used from the cookie. Then you got control of the expiry and session data is stored in Web Browser.
By adding the data for the filter into an URI parameter you can from page 2 include the data when user clicks a back button (not the browsers back button) The advantage of this its not session sensitive and the user can bookmark the url to get same filter later on.

Detect checked user permissions in view rendering, output within the HTTP response

I have a MVC website that has a custom permission system. When user calls a controller method I retrieve his permissions from the DB and store them in a object that I pass to view rendering.
In the view I render only some parts of the content (based on the permissions). I would like to add an output to the footer.
You have Permission1, Permission2 that are checked on this page. You
are missing Permission3.
Questions:
What is the appropriate http-request limited scope where I can keep a list of used permissions and add to it during the rendering?
Can I modify the finished HTML output after all the child actions are rendered?
2.1. I assume that this would be in the _Layout view after #RenderBody() is executed?

Get the UNC of a file that the end user selects

I am trying to create a Sharepoint webpart for a user to browse to, and select, a file from a share on our file server. Then I need to create a link to this file to display in a list of links that will go onto our Sharepoint intranet page. I have created a custom web part using asp.net/c# in order to do this but I am stuck on how to get the UNC path to the document. From my understanding it wont work with an asp.net fileupload control or a html input element. What other options would there be? I really don't want the user to have to type in the whole path to the document. This needs to be a re-usable solution so that my users can create new lists of links to documents when they so desire. Thanks for any advice.
I don't think the full file path is supported or allowed via modern web browsers via the file upload control. What you would end up having to do is create something server-side that use a service account to access the file share, and then the client (web page) could call the server-side code as it traverses the file share until the user selects a file.
Example:
server: on load, here are the contents of "\server\home"
client: show the contents of subfolder "\server\home\pictures"
server: connects to "\server\home\pictures" and returns contents
client: selects "\server\home\pictures\foo.jpg"
Check out System.IO.Directory http://msdn.microsoft.com/en-us/library/system.io.directory(v=vs.100).aspx for ways to get listing of directory contents server-side (GetFiles, GetDirectories, GetFileSystemEntries, etc) and then you can return those results to the client.

Show default page to all (including unauthenticated) users

Here is the situation: there has been an application for years. It's old and should not be used. Therefore I created a whole new application to replace the other. Now I want to show a piece of information to the users trying to access the old one (regardless whether already authenticated or, which is more likely, not yet authenticated) and a link to the new one.
I don't want to change anything in the old one or just change as few things as possible, it should stay. So I came up with an idea: why not backing up current Default.aspx and then creating new Default.aspx telling users to try and use the new application (maybe slightly modifying web.config but how?). However, when an unauthenticated user enters ~/Default.aspx, she gets redirected to the login page.
Is it possible to allow unauthenticated users to see this default page without getting redirected to the login page just to give their credentials and then see the default page telling that there is the other application?
Are you just looking to "announce" that users should go to the "new" application (and not do an auto-redirect)?
IF SO, then wouldn't a simple html page that made this announcement be your "linker"?
The reason I'm suggesting .html (instead of an .aspx page) is that if you "don't want to change anything" in the old site, then an html page/file takes it out of the "ASP.Net pipeline" (asp.net will not process it, IIS will) - I'm guessing that the entire old application requires authentication because you mentioned the default.aspx (normally the default document of the web site/application) already requires a login (which is why it redirects).
You can set the "old" application default document to be this (new) standard "announcement" page.
Hth...

Does ASP.NET has a built-in feature to get user history?

I'm looking for a built-in solution to get what pages the user has accessed through my ASP.NET application.
Here is a simple example :
Default.aspx
Page1.aspx
Page2.aspx
Page1.aspx <-- User is here
I want to get latest page before current one which in this example is Page2.aspx.
Maybe Master Page or ViewState could help ?
There is not a "built-in solution".
If you must do this-
If the history is small you could store it in a session.
If bigger, persist to a db.
You could also look into integrating with google analytics.
You could use Request.UrlReferrer to find out the page (or site) that took the user to the current page.
Or Page.PreviousPage which tells you the same info but has some caveats:
When you use the Transfer method or use cross-page posting to transfer
processing from one ASP.NET page to another, the originating page
contains request information that might be required for the
destination page. You can use the PreviousPage property to access that
information. If the current page is being rendered as a result of a
direct request (not a transfer or cross-post from another page), the
PreviousPage property contains null.
However, you only get the previous page. If you want the full history, you will have to enable/implement some sort of tracing in your app.

Categories

Resources